s builtin {
has $.f;
}
# This infix:<~~> doesnt work yet.
multi sub infix:<~~> ($x, Rul $r) is primitive is safe is builtin {$r.f.($x)}
multi sub infix:<~~> (Rul $r, $x) is primitive is safe is bu
y $m;
while 1 \{
my $s = substr($str,$pos) // last;
$m = $s ~~ $re or last;
my $m0 = {$m}[0];
my $at = $pos + $m0.from;
!! $a }))";
return $code;
}
# Use of Rul awaits working infix:<~~> .
#'Rul.new(:f(sub($_s_){$_s_ ~~ '~"$hook$adverbs$qo$pat$qc}))";
"$hook$adverbs$qo$pat$qc";
}
# These macro
al => 4);
#$collision->time == 1. More on that in L<Collision::2D::Collision>.
#$collision->axis ~~ [0,1] or [0,-1]. More on that in L<Collision::2D::Collision>.
=item intersection
print 'whoops'
ic type, e.g.:
$sth->bind_param( 1, $value, { ado_type => 6 } ); # adCurrency
If no type is given (neither by the provider nor by you), the datatype
defaults to SQL_VARCHAR (adVarChar).
=head2
ould only be
# done once for the application, not every time a command is run.
#~~~~~~~~~~~~~~~~~~~~~~~
# ARGV_Format
#
# non-interactive case: @ARGV: [app-opts] <cmd> [
;
Returns a usage message for the application or a specific (sub)command.
If a command name is given (optionally with subcommands), returns a usage
message string for that (sub)command. If no comma
e
data that has been returned.
=head2 serialize()
C<serialize()> will serialize the data it is given (if it's a
reference), and if the data is large enough and the savings
significant enough (and th
eader, $new_entries, $feed_obj, $error)
This callback is called if the C<interval> parameter is given (see above)
with the same arguments as the callback given to the C<fetch> method (see below).
=i
eq 'HASH')
? exists $k->{$err}
: $k eq $err
EOS
} else {
$test = '$err ~~ $k';
}
eval q#
sub raise(*@)
{
my $err = shift;
my @c = @CATCH;
local @CATCH = @LAST_C
r for the widget variables:
$_->has('label') ~~ exists $_{A}{label} ? (label=>$_{A}{label}) : ()
$_->has('label->value') ~~ exists $_{A}{label} ? (value=>$_{A}{label}) : ()
$
fault => sub { getcwd },
documentation => 'Directory for the keyword files and the feed file if given (default: current directory)',
);
has log_dispatch_conf => (
is => 'ro',
isa => 'HashRef',
la
p', "print usage message and exit" ],
);
print( $usage->text ), exit if $opt->help;
given ( scalar @ARGV ) {
when (0) {
$usage->die(
{
my $then = $now->clone;
if ( $props{unit} ) {
my $unit = $props{unit};
given ($unit) {
when ('h') { $unit = 'hours' }
when ('m') { $unit = 'minutes' }
if ( $hour < 13 ) {
$then->add( hours => 12 ) while $then < $now;
given ($suffix) {
when ('a') { $then->add( hours => 12 ) if $then->hour >= 12 }
my @keys = keys %$result;
return $result unless @keys == 1;
return $result unless $keys[0] ~~ ['int', 'str', 'real'];
my $values = $result->{$keys[0]};
return @$values == 1 ? $values-
(\w+)
}
rule value {
(\w+)
}
rule entry {
<key> '=' <value> (';')?
}
}
my $text = "foo=bar;me=self;";
if $text ~~ /^<Properties::entry>+$/ {
"Matched".say;
} else {
"Not Matched".say;
}
);
}
if ($self->_current && ref($self->_current) ne __PACKAGE__) {
given (ref $self->_current) {
when (/Gtk2::VBox|Gtk2::HBox/) {
$sel
given ($key) {
when ('id') {
$self->find($values[0], $self->_current);
}
when ('packing') {
given (ref $s
_lookup_filt {
my ($k, @args) = @_;
my $f = $Filters{$k} or croak "bad filter: $k";
given (reftype $f) {
when ("CODE") { return $f }
when ("REF") { return ($$f)->(@ar
try: $k => $f" }
}
}
sub _decode_filt {
my ($f) = @_;
defined $f or return;
given (reftype $f) {
when ("CODE") { return $f }
when (undef) { return _lookup_fil
;
my $lo = sub { $_[0] . (defined $_[1] ? ":$_[1]" : "") };
sub {
given ($_) {
when ([".", "&"]) {
$repl->(@_[1, 5]);
DOC use Pod6::Markovian;
or:
DOC BEGIN {
use Pod6::Literate;
if ($?DOC ~~ /short/) {
literate_sequence(<
NAME
AUTHOR
EXPR1)) {
if ($_ =~ (EXPR2)) { ... }
}
[Update: the C<=~> operator has been renamed C<~~>.]
=head3 Table 1: Matching a switch value against a case value
$a $b Type of Ma
an operator on every case, simply provide an empty given,
to be read as "given nothing...":
given () {
when $a.isa(Ant) { ... }
when $b.isa(Bat) { ... }
when $c.isa(Cat) {
}
}
This works because =~ is considered a boolean operator.
[Update: The operator is C<~~> now.]
RFC:
catch not &TooSevere => { ... }
Now:
when not &TooSevere { ... }
The unar
inst
the current topic. That is,
doit() when 42;
is exactly equivalent to
doit() if $_ ~~ 42;
This is particularly useful for list comprehensions:
@lucky = ($_ when /7/ for 1..100);
be expressed as methods or smart
patterns.
if $filename.:e { say "exists" }
# or
if $filename ~~ :e { say "exists" }
=head2 Junction Operators
Perl 6 introduces a new scalar data-type: the B<ju
to provide a generic "smart
match" operator.
So he did. It's called C<=~>.
[Update: Now called C<~~> instead.]
Yes, the humble Perl 5 "match a string against a regex" operator is
promoted in Perl 6
nce
INCLUSIVE OR || or
EXCLUSIVE OR ~~ xor
DEFINED OR // err
[Update: High
$x = $cond ? $true : $false;
$s = "con" ~ "cat" ~ "enate"; $s = "con" . "cat" . "enate";
$str ~~ /$pattern/; $str =~ /$pattern/;
Any time you see a C<~> in Perl 6, it has something t
of not knowing the language at all or from knowing Perl 5, it's enough to
know initially that C<~~> will pattern match on strings).
=head2 New Perl 6 Syntax
Perl 6 also has some brand-new syntax.