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 }, @
?:.*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(
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");
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
C<when> statement, because:
when $is_sheep { push @sheep, $_ }
is equivalent to:
if $_ ~~ $is_sheep { push @sheep, $_; next }
When C<$is_sheep> is a subroutine reference, that implicit sm
my $context = want;
if $context ~~ List {
my @values = block();
return { *@values };
}
elsif $context ~~ Scalar {
my $value = block();
|
|-----------------------------------|
| ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |~~
$comments,
===================================
.
write STDOUT;
in Perl 6 we
har><1,$width>) /;
# Squeeze the resultant substring...
(my $result = $1) ~~ s:each/ <$ws> | \v+ /\c[SPACE]/;
# Check for any more data still to come...
r:
sub expurgate (Str *@hidewords) {
return sub (Str $data is rw) {
$data ~~ s:ei/(@hidewords)/$( 'X' x length $1 )/;
return $data;
}
}
We could then
=item * C<=~> becomes the "smart match" operator C<~~>, with a whole new set
of semantics. Anywhere you used C<=~> before you now use C<~~>, but C<~~> is
much more general now. See L<Synopsis 4> for
<=~> >> macro which always fails at
compile time with a message directing the user either to use C<~~> or C<~=> instead,
or to put a space between if they really wanted to assign a stringified value.)
smartmatches the
endpoints in the domain of the object being matched, so C<< 1.5 ~~
1^..^2 >> is true. (But C<< 2.1 ~~ 1..2 >> is false.)
=item * The unary C<^> operator generates a range from C<0>
= %*ENV<QUERY_STRING> // %*ENV<REDIRECT_QUERY_STRING>;
if ($.query_string ~~ /<[;&=]>/) {
$.query.parse_params($.query_string);
} else {
les);
}
sub fill_with($template: %variables?) is export {
my $return = $template;
$return ~~ s:g! <elem> | <block> !{ run_widget($/, %variables) }!;
return $return;
}
## some basic widge
in32 mingw msys cygwin> {
$redir_pre = ">";
$redir_post = "";
};
my $file = $?FILE;
$file ~~ s:P5/output.t/script.pl/;
my $cmd = "$*EXECUTABLE_NAME $file $redir_pre $out_fn $redir_post";
%*EN
4,5,6));
is($union.WHAT, Set, "set() - union");
my $stringified = $set.stringify;
ok($stringified ~~ rx:perl5/^set\(.*Person.*\)$/, "stringify");
ok($union.equal(set(0..6, $bob)), "set() - equal");
use v6-alpha;
use Rosetta::Shell;
my Str @cmd_line_args = @*ARGS.grep:{ $_ ~~ m/^<[a-zA-Z:_]>+$/ };
my ($engine_name, @user_lang_prefs) = @cmd_line_args;
$engine_name //= 'Rosetta::Engine::Example'
IL::Util::Pad $.parent;
has Str @.names;
method lookup_pad($name) {
if (grep { $_ ~~ $name }, @.names) {
self;
}
else {
$.parent ?? $.parent.lo
Kiss;
=cut
my $RAND = Math::Random::Kiss.new();
ok($RAND, 'new() Math::Random::Kiss');
ok($RAND ~~ Rand, 'Math::Random::Kiss does Rand');
ok($RAND.rand() >= 0, 'rand() returns numbers greater than
d y $& ab
a(?{"{"}})b - c - Unmatched right curly bracket
a(?{$bl="\{"}).b caxbd y $bl {
x(~~)*(?:(?:F)?)? x~~ y - -
^a(?#xxx){3}c aaac y $& aaac
'^a (?#xxx) (?#yyy) {3}c'x aaac y $& aaac
(?<![cd])b d
unction $test ; *@values) returns List {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}
multi sub join (Str $delimiter ; *@values) returns List {
my $str = ~@v
use v6-alpha;
use Test;
plan 1;
use Text::Glob;
my $regex = Text::Glob.new.glob_to_regex('*.pm');
ok 'Glob.pm' ~~ $regex, 'glob_to_regex works';
% 26];
@.table[@lower[$_]] = @lower[($_ + $shift) % 26];
}
}
if $mode ~~ m:P5:i/^de/ {
my @tt;
for @.table.kv { @tt[$^value] = $^key }
@.table = @t