of C<@array>, in order.
If C<$indextest> is provided, only elements whose indices match
C<$index ~~ $indextest> are iterated. (To select on values use C<grep>.)
What is returned at each element of
as C<%hash> doesn't change.
If C<$keytest> is provided, only elements whose keys evaluate
C<$key ~~ $keytest> as true are iterated.
What is returned at each element of the iteration varies with fun
will return 0 and issue
a warning.
=item pack
our buf8 multi pack( *@items where { all(@items) ~~ Pair } )
our buf8 multi pack( Str $template, *@items )
C<pack> takes a list of pairs and formats
me,0,1);
Optionally, you can use substr on the left hand side of an assignment
like so:
$string ~~ /(barney)/;
substr($string, $0.from, $0.to) = "fred";
If the replacement string is longer or sho
nite strings in
parallel, though that seems a bit scary.
[Update: The C<=~> operator is renamed C<~~>, and it doesn't automatically
"any-fy" an array anymore, so we could pretty easily make it work o
backtrack over C<< <cut> >>, the entire match
will fail.)
[Update: Now we can just say C<<@lines ~~ s/^.*? \n**{2...} //>>.]
=head2 RFC 110: counting matches
I think we can avoid using any options
ingly, that can also be written:
/ <( _/\d+/ =~ 1..10 )> /
[Update: That'd be C<< <?{ ~/\d+/ ~~ 1..10 }> >> these days.]
=head2 RFC 198: Boolean Regexes
Again, I'm not much in favor of inventi
r context. The first match at any position is returned.
$str = "abracadabra";
if $str ~~ m:overlap/ a (.*) a / {
@substrings = $/.matches(); # bracadabr cadabr dabr br
}
ontext, or a disjunction of matches in a scalar context.
$str = "abracadabra";
if $str ~~ m:exhaustive/ a (.*) a / {
@substrings = $/.matches(); # br brac bracad bracadabr
in a value context (void,
Boolean, string, or numeric), or when it is an explicit argument of
a C<~~>. Otherwise it's a rule constructor. So this:
$var = /pattern/;
no longer does the match
range if no quality file was given (default: 30)
bad_qual Quality score to set for bases outside clear range
if no quality file was given (default: 10). If your
= shift;
my @args = @_;
my $minified = '';
foreach my $arg ( @args ) {
given ( $arg ) {
when ( -f $arg ) {
$minified .= $self->process_file( $arg
n",
$keys, $_, $caller, $filename, $linenum
unless $keys ~~ $keycheck;
} else {
die sprintf "key list not supported with type %s at
} elsif ( ! defined $value ) {
return $type & UNDEF;
} else {
given ( ref $value ) {
when ( '' ) { return $type & SCALAR };
default
die sprintf "value '%s' is not a legal value for $name\n", $value // '*undef*'
unless grep $_ ~~ $value, @$legit;
}
# ----------------------------------------------------------------------------
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
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
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
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
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
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
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-
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 }
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
r for the widget variables:
$_->has('label') ~~ exists $_{A}{label} ? (label=>$_{A}{label}) : ()
$_->has('label->value') ~~ exists $_{A}{label} ? (value=>$_{A}{label}) : ()
$
);
}
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
(\w+)
}
rule value {
(\w+)
}
rule entry {
<key> '=' <value> (';')?
}
}
my $text = "foo=bar;me=self;";
if $text ~~ /^<Properties::entry>+$/ {
"Matched".say;
} else {
"Not Matched".say;
}