2 { ... }
when want.List { ... }
The C<want> function can be used with smart matching:
if want ~~ List & 2 & Lvalue { ... }
Which means it can also be used in a switch:
given want {
when Li
ctation count is C<Inf>. You shouldn't
actually return an infinite list, however, unless C<< want ~~ Lazy >>.
The opposite of C<Lazy> context is C<Eager> context (the Perl 5 list
context, which alway
ve where => Parametric, value => (1,2,3);
leave Loop, label => 'LINE', $retval;
leave { $_ ~~ Block and $_ !~ Sub } 1,2,3;
leave () <== 1,2,3;
As it currently stands, the parens aren't op
er. The preceding may
also be written:
use Dog-{$^ver ~~ 1.2.1 | 1.3.4}-{$^auth ~~ /:i jrandom/};
use Dog-{$^ver ~~ Any}-{$^auth ~~ /^cpan\:/}
In any event, however you select the module, i
ormat first.
if $path ~~ s/ \{ (\w+) \} $// {
$.mode = ~$0;
}
else {
$.mode = 'view';
}
if $path ~~ s/ \. (\w+) $// {
ailing slash, if any.
$path ~~ s:g{^/|/$}{};
# A leading [NUM] with no name indicates the root revision to use.
if $path ~~ s{^ \[ (\d+) \] /?}{} {
f the path
if $path {
for split '/', $path -> $comp {
$comp ~~ /^ (\w+) [ \[ (\d+) \] ]? $/
or WWW::Kontent::error("Invalid component '$comp'",
ext = $origtext;
say $ERR: "Parsing $origtext.chars() chars of text" if $PROGRESS;
while $text ~~ $parser_regex {
my($chunk, $tag)=(~$0, ~$1);
my $length = "$0$1".chars;
$pos += $length;
chunk.chars() literal chars followed by tag '$tag'" if $PROGRESS;
if $chunk.chars {
$chunk ~~ s:g{\s+}{ };
@stack[-1].add_text($chunk);
}
given $tag {
when "\\\\" {
# nothing
}
if $text.chars {
say $ERR: " $text.chars() literal chars left over" if $PROGRESS;
$text ~~ s:g{\s+}{ };
$base.add_text($text);
}
return $base.children;
}
my sub do_list($skel, $type, $
agepath.format}.new()
unless $.renderer;
$output=$.renderer.render($r);
#};
if $! ~~ /^\[restart\]/ {
if $depth < 8 {
$r.go($depth+1);
}
else {
$.status = 504;
$.
ext/plain';
return "Error: restart limit exceeded--possible restart loop";
}
}
elsif $! ~~ /^\[(\d\d\d)\] (.*)/ {
$.status = $0;
$.type = 'text/plain';
return "Error: $1";
}
ursor.parent;
}
}
}
my $pathobj=WWW::Kontent::Path.new().parse($path);
if $path ~~ m{^/} {
# Full path--just resolve from the root page.
try { $pathobj.resolve($.root, $se
or $rev.attributes.kv -> $k, $v is copy {
$v ~~ s:perl5:g{\\}{\\\\};
$v ~~ s:perl5:g{"}{\\"};
$v ~~ s:perl5:g{\015}{};
$v ~~ s:perl5:g{\n}{\\n};
$v ~~ s:perl5:g{ }{\\t};
say qq( $k: "$v");
# now try to get it processing again
MogileFS::ProcManager->ProcessQueues;
}
}
# given (job, pid), record that this worker is about to die
sub note_pending_death {
my ($job, $pid)
sub infix:«~~» (Item $left, Item $right) is primitive {
if $right.isa(::Rul) {
$right.matcher.($left);
} elsif $right.isa(Str) {
$left eq $right;
}
}
sub infix:«!~» (Item $left, Ite
m $right) is primitive { not $left ~~ $right }
$pattern = ($negate) ?? "([^$unsafe])" !! "([$unsafe])";
$string ~~ s:P5:g/$pattern/{ %escapes{$0} || fail_hi($0) }/;
return $string;
}
}
# multi sub uri_unescape ($str is copy) returns Str is export(:DEFAULT) {
# $str ~~ s:P5:g/%([0-9A-Fa-f]{2})/{ chr(:16($0)) }/;
#
# return $str;
# }
multi
$caller.package;
$package ~~ s/.*\:\://;
%tags{$package}=1;
}
@msg = ["Note: currently"] unless @msg;
if $active eq any('all', keys %tags) {
unless @msg[-1] ~~ /\n$/ {
@msg.push(" at $
$rule_string ~= "{sprintf("%03b",$k)} becomes {+$v}\n";
}
$rule_string ~~ s:g/1/$true/;
$rule_string ~~ s:g/0/$false/;
return $rule_string;
}
}
?:.*foo&\D*(\d+))' );
ok( $r1->qr, ~~qr/^(?:(?=.*foo)\D*(\d+))/ );
ok( $r2->regex('^(?:.*foo!\D*(\d+))') );
ok( $r2->visual, '^(?:.*foo!\D*(\d+))' );
ok( $r2->qr, ~~qr/^(?:(?!.*foo)\D*(\d+))/ );
ok(
method BUILD() {
self.add_handler("PRIVMSG", -> $event {
my $sent_to_a_chan = $event<object> ~~ rx:Perl5/^[#+&]/;
# Only record if the message was sent to a channel.
%!seen{self.nor
te => time,
text => $event<rest>,
} if $sent_to_a_chan;
if $public and $event<rest> ~~ rx:Perl5/^\?seen\s+([^ ]+)/ {
my $reply_to = $sent_to_a_chan ?? $event<object> !! $event<fro
debug;
my $dh = $dir.opendir;
for $dh.readdir -> $node {
next if $node ~~ m:P5/^(?:\.){1,2}$/;
my $abs = catdir( $dir, $node );
unless -d $abs {
= File::Find.new;
$f.wanted_file = sub ( $file, $path, $pathfile ) {
return 1 if $file ~~ m:P5/^.*\.pm$/;
}
$f.dirs = qw/lib/;
my @files = $f.find;
# debug attribute for s
ber<30>);
is($rule ~~ ::Automata::Cellular::Rule, Bool::True, '$rule object instantiated');
is($rule.rule_number(), 30, '$rule rule_number set correctly');
is($rule.rule ~~ Hash, 1, '$rule.rule
sub hashify (Str $spec is copy) returns Hash {
my @with_args = $spec ~~ rx:P5:g/([^:]):/;
my @without_args = $spec ~~ rx:P5:g/([^:])(?!:)/;
#@with_args.perl.say;
(map { ;~$_ => 0 }, @
$?OS eq 'os2' );
&readlink := { undef } if $dosish;
unless ( ( $script ~~ m:P5 [/] || ( $dosish && $script ~~ m:P5 [\\] ) )
&& -f $script )
{
for File::Spec.path(
er($match)};
is( $match?1:0, 0, 'booleanify' );
}
}
# <TimToady> ?eval "a\nb" ~~ /^a$$.^^b$/
# "a\nb" ~~ m:P5/(?smx) \A a $ . ^ b \z/
{
my $rule = __PACKAGE__->compile( '^a$$.^^b$' );
path);
for =$fh -> $line {
$start = 1 if $line ~~ rx:perl5/^=pod/;
if $start { $expected_output ~= "$line\n" }
$start = 0 if $line ~~ rx:perl5/^=cut/;
}
$fh.close();
$expected_outp
ate = (+<<@.state[$.steps..(@.state.elems() - $.steps)]).join("");
$state ~~ s:g/0/$false/;
$state ~~ s:g/1/$true/;
"Stage $.stage: $state";
}
multi sub *postfix:<++>