sub get_committer_list (Str $dict_file) returns List {
my @committers;
my $dict = open($dict_file) err die "Couldn't open the AUTHORS file.
You must run this script from within the main pugs
directory or within the examples sub-directory.";
# Skip the intro text
1 while =$dict ~~ rx:perl5/\S/;
for (=$dict) -> $name { ### UNARY =
# Capture the real name part
if ($name ~~ rx:perl5/^(.+?)(?:\s\s|$)/) { ### SMART MATCHING
my $realname = $1;
# Remove nickname
$realname ~~ s:perl5/\s*".*"\s*/ /;
@committers.push($realname);
}
}
$dict.close();
return @committers;
}
-
err
is the low precedence form of //
(S03). //
is especially useful as
$x //= $y;
-
To summarize,
||
and or
relate to truth,
while //
and err
relate to
definedness.
-
Next, we use smart matching,
~~
(S04 - belongs in
S03), to skip all of the lines from the beginning of the file
which have something other than whitespace.
-
we use the unary
=
to perform a readline
operation on the filehandle.