}
default {
die q(I don't know what to do with $foo);
}
}
C<given(EXPR)> will assign the value of EXPR to C<$_>
within the lexical scope of the block, so it's simi
he power comes from implicit smart matching:
when $foo
is exactly equivalent to
when $_ ~~ $foo
In fact C<when EXPR> is treated as an implicit smart match most of the
time. The exceptions
ral array
or hash as the argument to C<when>, it is turned into a
reference. So C<given(@foo)> is the same as C<given(\@foo)>,
for example.
C<default> behaves exactly like C<when True>, which is
to s
$self = shift;
my $d1 = RPG::Dice->new('1d6');
my $d2 = RPG::Dice->new('2d6');
given ( $d2->roll() ) {
when (2) {
$self->type(A);
}
when ( [ 3 ..
e(G);
}
when ( [ 10 .. 12 ] ) {
$self->type(F);
}
}
given ( $d2->roll() ) {
when (2) {
$self->size(II);
}
when (3) {
self->{$dialog}, $boot) : $self->{$dialog};
}
## @method hide_dialog($dialog)
# @brief Hide the given (name of a) dialog.
sub hide_dialog {
my($self, $dialog) = @_;
$self->{$dialog.'_position
et_widget($dialog)->hide();
}
## @method $dialog_visible($dialog)
#
# @brief Return true is the given (name of a) dialog is visible.
sub dialog_visible {
my($self, $dialog) = @_;
my $d = $sel
ector" );
sub getSpectralClass {
my $self = shift;
my $d1 = RPG::Dice->new('1d6');
given ( $d1->roll() ) {
when ( [ 1, 3, 5 ] ) {
my $roll = ( $d1->roll() ) + 4;
mns = $schema->source( $lookup )->primary_columns;
my @columns_without_primary_keys = grep{ !($_ ~~ @primary_columns) } @columns;
my $guessed_field;
# classic lookup table with only two columns
or croak("Cannot proceed without a 'file' or 'io' attribute");
# discard first row if columns given (see POD for 'no_header' option)
$self->{first_row} = $self->get_raw_row()
if $self->{colum
->isa('PPI::Token::Word') # the tokens
and $_[1]->literal ~~ [ 'map', 'grep', 'sort' ] # 'map' and 'sort' ('grep' doesn't hurt here and you could
I::Token::Word') # you could watch out for more
and $_[1]->literal ~~ [ 'map', 'sort' ] # 'grep', 'uniq', ...
}
)
} or return;
$self->
led down to a pure source servlet, loaded into memory, and ready to take whatever arguments were given (either from the URL, session, or post form) to produce output content. I saw this in a greater
.
If no display switches are specified, pv behaves as if -p, -t, -e,
-r,
and -b had been given (i.e. everything except average rate is
switched
on). Otherwise, only those display types
_mono(visual, colormap);
OUTPUT:
RETVAL
#OUTPUT: integer
#DESC: Get the pixel value for the given (red, green, blue) tuple.
void
get_pixel(colorc, red, green, blue)
Gtk::Gdk::ColorContext colorc
$env) = @_;
my $req = Plack::Request->new($env);
$req->query_parameters->get($self->key) ~~ $self->password;
}
sub unauthorized {
my $self = shift;
my $body = 'Authorization requir
my ($self, $struct, $type_map, $key) = @_;
#attempt reading common data structures
given (ref($struct)) {
when ('ARRAY') {
return [ map {
$self->_yaa
#attempt custom type mapping
if ($target) {
given (ref($target)) {
when ('CODE') {
return $target->($st
argument is given, then it is
treated as an option name, and the description for that option is given (a la
longhelp).
END
default => 0,
linkage => sub { $_[0]->dump_help(undef, $_[2])
$lookback tests did not have the same success state
return 0 if not $this_success ~~ $success;
}
my $testrun_success = get_testrun_success($testrun->{id});
re
condition
#
# =cut
#
# sub matches
# {
# my ($self, $condition, $event) = @_;
# given($event->type){
# when ('testrun_finished') {
# $testrun
return $success;
# }
#
sub matches
{
my ($self, $condition, $event) = @_;
given($event->type){
when ('testrun_finished') {
$testrun
w(reftype);
sub new {
my $class = shift;
my $name = shift || 'hash';
if ('HASH' ~~ reftype($name)) {
my $args = $name;
$name = delete $name->{type};
return $
>access_token,
token_secret => $self->access_secret,
);
}
if ($method ~~ ['POST', 'PUT']) {
my $u = URI->new('http:');
if (@args) {
push @extra
ess ref $self->report;
return unless defined $self->report->status
and $self->report->status ~~ [qw/DONE FAIL/];
return $self->report->status
}
sub failed {
my ($self, $reason) = @_;
i
ump {
my ($self) = @_;
return unless ref $self->report;
return unless $self->report->status ~~ [ qw/DONE FAIL/ ];
return $self->report->netinfo
}
sub report { info(@_) }
sub info {
my ($s
($opt->{to_dsn}) or die "Can't parse DBI DSN '$opt->{from_dsn}'";
my $module;
given (lc($driver)) {
when ('sqlite') { $module='DBICx::Backend::Move::SQLite' };
args) = parse_line('\s+', 0, $cmd);
next PROMPT unless $thiscmd;
unless ( lc($thiscmd) ~~
[ qw/h help q quit open create freeze thaw/ ]
) {
unless ( $self->_get_curr
( index($args[0], '--') == 0 ) {
my $f_opt = shift @args;
substr($f_opt, 0, 2, '');
given (lc($f_opt//'')) {
$format = 'YAMLXS' when "yaml";
$format = 'YAML' when "syck";
( index($args[0], '--') == 0 ) {
my $f_opt = shift @args;
substr($f_opt, 0, 2, '');
given (lc($f_opt//'')) {
$format = 'YAMLXS' when "yaml";
$format = 'YAML' when "syck";
stance, here are some operators that
choose to handle C<*> and give it special meaning:
if $x ~~ 1..* {...} # if 1 <= $x <= +Inf
my ($a,$b,$c) = "foo" xx *; # an arbit
# means 'a' xx Inf
1,* # means 1,* :)
$a = * # just assigns Whatever
$a ~~ * # just matches Whatever
Note that the last two also do not autocurry C<WhateverCode>, becau
sign if $val~~Int or $val~~Str
Fancier type constraints may be expressed through a subtype:
subset Shinola of Any where {.does(DessertWax) and .does(FloorTopping)};
if $shimmer ~~ Shinola {.