if @params[$i+1] ~~ m:perl5 {:$} {
@params[$i] ~~ s:perl5 {:$}{,};
}
}
}
my $param_list = @params.join(" ");
$param_list ~~ s:perl5 {,$}{}; # rem
"$statements\n" ~
" # TODO - _end_pad\n";
}
sub emit_Variable ( $s is copy ) {
$s ~~ s:perl5/^"(.*)"$/$0/;
$s
}
sub emit_Int ( $s ) { $s }
sub emit_Str ( $s ) { $s }
sub emit_Rat
f $default eq '';
# rewrite '$name,' to '$name = default,'
my ($name, $separator) = $param ~~ m:perl5 {(.*)(.)};
$default ~
$name ~
' = ' ~
$separator
}
# -- Main prog
bin/jerkme.rss HTTP/1.0\n",
"Host: www.phreeow.net\n"
);
$hdl.flush;
if ($hdl.slurp ~~ rx:perl5{<description>(.+)</description>\s*</item>}) {
say $0;
}
else {
say "*** O
sent over the wire, and analyzes the response. This line is worth
breaking down:
if ($hdl.slurp ~~ rx:perl5{<description>(.+)</description>\s*</item>}) { ... }
# Perl 5 equivalent
sub slurp {
l 5. The other difference
is that instead of using C<=~>, we now use C<~~> to match. The change
is not just one of spelling: C<~~> is the shiny new I<smart match>
operator, which has very well-defined
elsif (($k.chars > 1) && (substr($k,-1,1) eq "x") # XXX - excess parens required
&& ($k ~~ %rx_helper_cache{'re_x'})) {
my $n = 0+ ~$0; # +$0 XXX
%mods.delete($k);
%mods{'
n;
}
elsif (($k.chars > 2) && (substr($k,-2,2) eq ("th"|"st"|"nd"|"rd"))
&& ($k ~~ %rx_helper_cache{'re_nth'})) {
my $n = 0+ ~$0; # +$0 XXX
%mods.delete($k);
%mods
g) {
my $s = ~$string;
my $offset = 0;
my @a;
while 1 {
my $m = $s ~~ $rx;
last if !$m;
push(@a,$m);
my $off = $m.to +1;
# $m.from += $o
$string;
$result ~~ s:Perl5:g/&\#(\d+);?/{chr($0)}/;
$result ~~ s:Perl5:g/(&\#[xX]([0-9a-fA-F]+);?)/{my $c = :16($1); $c < 256 ?? chr($c) !! $0}/;
$result ~~ s:Perl5:g/(&(\w+);?)/{%en
code\n "
# ) if $!;
#}
#%subst{$unsafe_chars}($string);
$result ~~ s:Perl5:g/([$unsafe_chars])/{
%char_to_entity.exists($0)
?? %char_to_e
}
else {
# Encode control chars, high bit chars and '<', '&', '>', '"'
$result ~~ s:perl5:g/([^\n\r\t !\#\$%\'-;=?-~])/{
%char_to_entity.exists($0)
?? %
tem Matcher
subset Matcher of Item | Junction;
Used to supply a test to match against. Assume C<~~> will be used against it.
=item Ordering
subset KeyExtractor of Code where { .sig === :(Any -->
e where { .sig === :(Any, Any --> Int ) };
subset OrderingPair of Pair where { .left ~~ KeyExtractor && .right ~~ Comparator };
subset Ordering where Signature | KeyExtractor | Comparator | Orderin
f C<@array>, in order.
If C<@indextests> are provided, only elements whose indices match
C<$index ~~ any(@indextests)> are iterated.
What is returned at each element of the iteration varies with fun
$var (keys %{$to_instantiate||{}}){
my $class = $to_instantiate->{$var};
given(ref $class){
when('HASH'){
my ($package, $method) = %$class;
exit; # exit child
}
}
};
method _req_handler($req) {
my $res = eval {
given($req->uri){
when(m{^/(?:index(?:[.]html?)?)?$}){
return $self->_rende
to HTML
=head1 SYNOPSIS
use Text::GooglewikiFormat;
my $raw = '*bold* _italic_ ~~strike~~';
my $html = Text::GooglewikiFormat::format($raw);
# $html is qq~<p><strong>bold</st
_function_from_definition {
my ($package, $function, $fdef, $shift, $precondition) = @_;
given(ref $fdef){
when('ARRAY'){
my @fdef = @$fdef;
my $func;
= $plugin->upper_bound($port);
Returns the maximum value for the $port, or C<undef> if none is given (assume 1).
Also L</is_sample_rate|see is_sample_rate>.
=head2 is_sample_rate
my $max = $plug
Perl 6: generalisierter Smart-Match-Operator
$s ~~ 1978;
$s ~~ "Hallo, Welt";
$s ~~ /regex/;
$s !~ funktion();
#=Alles zusammen: (änlich wie any)
$s ~~ (123, funktion, /regex/)
($a, $b, $c) !~ ($d, $
*@indextests --> Int|List )
{
my @ret;
for @array.kv -> ($k, $v) {
push(@ret, $k ) if $k ~~ any(@indextests);
}
@ret; # want Item ?? +@ret !! *@ret;
}
# signature from S29draft.pod r
ests --> Int|List )
{
my @ret;
for @array.keys -> $k {
push(@ret, ($k,@array[$k]) ) if $k ~~ any(@indextests);
}
@ret; # want Item ?? +@ret !! *@ret;
}
# signature from S29draft.pod r
*@indextests )
{
my @ret;
for @array.keys -> $k {
push(@ret, Pair($k,@array[$k]) ) if $k ~~ any(@indextests);
}
@ret; # want Item ?? +@ret !! *@ret;
}
# signature from S29draft.pod r
~~ m/^(\Q$const\E)(.*)/s;
# return unless @_[0] ~~ perl5:m:s:/^(\Q$const\E)(.*)/;
# return unless @_[0] ~~ /^ ( $const )(.*)/; # (putter on #perl6)
# return unless @_[0] ~~
est = =$hdl;
$request ~~ s:P5/\s+$//;
#diag $request;
if ($request ~~ rx:P5"^GET /stop-server/") {
last();
};
while (readline($hdl) ~~ rx:P5/\S/) { 1 };
$h
-)
# threads while running an external command)
for @urls -> $t_url {
my $url = $t_url;
$url ~~ s:perl5/%s/$base_url/;
my $inc = map {qq! "-I$_"!}, @*INC;
# Will block forever
# my $outpu
{ }
method parse (Str $str is copy) {
my $status_line;
if ($str ~~ s/^(.*)\n//) {
$status_line = $0;
} else {
$status_line = $str;
elf = self.SUPER::parse($str);
given ($self) {
my ($protocol, $code, $message);
if ($status_line ~~ /^\d**{3}/) {
# Looks like a r
# HTTP/1.0
require URI;
if ($base.defined && $base ~~ /^ <URI::scheme> \:/) {
# already absolute
return $HTTP::URI_CLASS.new($ba
ne = $fh.readline;
last unless $line.defined; # exit as soon as possible
if ($line ~~ rx:P5/^=pod/) {
$is_parsing = 1;
%events<start_document>();
}
efined($_line) &&
!($_line ~~ rx:P5/^$/) &&
$_line ~~ rx:P5/^\s(.*?)$/ ) {
while (defined($_line) &&
!($_line ~~ rx:P5/^$/) ) {
interpolate($_line, %events);
~~ m/^(\Q$const\E)(.*)/s;
# return unless @_[0] ~~ perl5:m:s:/^(\Q$const\E)(.*)/;
# return unless @_[0] ~~ /^ ( $const )(.*)/; # (putter on #perl6)
# return unless @_[0] ~~
"~~" . $::CLASS->name . "~~";
}
}
};
my $pp = $PrettyPrinter->new();
isa_ok($pp, 'PrettyPrinter');
is($pp->pretty(), '~~PrettyPrinter~~', '.
is(
$pp->pretty({ array => [ \1, \'two', $pp ] }),
'{ array => [ 1, two, ~~PrettyPrinter~~ ] }',
'... recursive multi-methods');
}
{
my $PrettyPrinter2 = class '
ty = ::multi_sub 'PrettyPrinter2::pretty' => ('PrettyPrinter2') => sub {
"~~" . $::CLASS->name . "~~";
};
$::CLASS->add_method('pretty' => ::make_method($pret
ne = $fh.readline;
last unless $line.defined; # exit as soon as possible
if ($line ~~ rx:P5/^=kwid/) {
$is_parsing = 1;
%events<start_document>();
}
fined($_line) &&
!($_line ~~ rx:P5/^\n$/) &&
$_line ~~ rx:P5/^\s(.*?)$/ ) {
while (defined($_line) &&
!($_line ~~ rx:P5/^\n$/) ) {
interpolate($_line, %events);
e($n) {
'subset int'~$n~' of ValueType where { $^n ~~ Int and -2**'~$n~' <= $^n < 2**'~$n~' };
subset uint'~$n~' of ValueType where { $^n ~~ Int and 0 <= $^n <= 2**'~$n~' };'
}
Clutter
ize($n) {
'subset num'~$n~' of ValueType where { $^n ~~ Num and ...XXXfill in... };
subset complex'~$n~' of ValueType where { $^n ~~ Num and ...XXXfill in... };'
}
Clutter::num_size 32;
Clutt
or more arguments
are given, returns a list of table objects with those names, in the
same order given (or the number of such tables in a scalar context,
but this isn't terribly useful).
An L<C<Alzab