"stringify"
;
# Overload smart-match only if we're using 5.10
use if ($] >= 5.010), overload => '~~' => "matches";
our $VERSION = '2.13';
my $PACKAGE = __PACKAGE__; # Useful to have a scalar for
en') ) { ... }
if ( $e ~~ 'open' ) { ... }
C<matches> is used to determine whether a
given exception matches a particular role. On Perl 5.10,
using smart-match (C<~~>) with an C<autodie::except
$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
get_report_failures
{
my ($self, $report) = @_;
return $report->get_cached_tapdom ~~ dpath '//tap//lines//is_ok[value eq 0]/..';
}
sub index :Path :Args(1)
{
my ( $self, $c,
$env) = @_;
my $req = Plack::Request->new($env);
$req->query_parameters->get($self->key) ~~ $self->password;
}
sub unauthorized {
my $self = shift;
my $body = 'Authorization requir
te;
my $keep_alive_timeout_date = $self->state_details->keep_alive_timeout_date;
given ($self->state_details->current_state){
when(['invalid', 'finished', 'started']){
f ( $installer_timeout_date <= $now) {
my $msg = 'timeout hit ';
given ($self->state_details->current_state){
when ('started') { $msg .=
or => 1,
msg => "Timeout in PRC $prc_number "};
given($self->state_details->prc_state($prc_number)){
when ('boot'){
(my $main_module = $distro) =~ s/-/::/g;
$main_module = $modules[0] unless ($main_module ~~ @dmods);
# remove any obvious split potentials
if ($self->removal_leve
node_name,
$os->name(long => 1, edition => 1),
~~localtime($os->build),
);
$uname .= " [Sys::Info]";
return
->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->
($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' };
w(reftype);
sub new {
my $class = shift;
my $name = shift || 'hash';
if ('HASH' ~~ reftype($name)) {
my $args = $name;
$name = delete $name->{type};
return $
my $p(@{$pad}){
next if !( defined $p && !$p->{outside} );
if($p->{count} ~~ 0){
next if $args->{ignore_vars}{$p->{name}};
if(my $cb = $args->
f, but how do we apply these rules to a string other than C<$_>?
We use the smart match operator C<~~>. This operator is called "smart
match" because it does quite a bit more than just apply regular
expression against the string contained in a variable called C<$foo>,
we'd do this:
$foo ~~ / <regex here> /;
There's a more general syntax that allows the author to choose
different delimi
h the
C</> character and you don't feel like writing C<\/> so much:
$foo ~~ m/ <regex here> /;
$foo ~~ m! <regex here> !; # different delimiter
=head3 Modifiers
The more genera
ers from patsubst
# in that it will perform correctly when alternate names for directories are
# given (as long as they precede the percent sign). For example,
#
# $(filesubst ./src/%.c, %.o, $(wild
use parent 'Tapper::Cmd';
sub get_module_for_type
{
my ($self, $type) = @_;
given (lc($type)){
when('multitest') { return "Tapper::Cmd::Testrun"; }
differs from patsubst
in that it will perform correctly when alternate names for directories are
given (as long as they precede the percent sign). For example,
$(filesubst ./src/%.c, %.o, $(wild
ers from patsubst
# in that it will perform correctly when alternate names for directories are
# given (as long as they precede the percent sign). For example,
#
# $(filesubst ./src/%.c, %.o, $(wild
# This is much simpler with the ~~ operator, but Perl 5.10
# features are being avoided until 5.10 is standard both on MacOSX
# and Debian
# Note that the ~~ operator only checks keys of h
ashes, not values
# unless(%atts1 ~~ %atts2)
unless($attkeys1 eq $attkeys2)
{
debug(3," elements have different attributes");
return 0;
}
foreach my $att (keys %at
>access_token,
token_secret => $self->access_secret,
);
}
if ($method ~~ ['POST', 'PUT']) {
my $u = URI->new('http:');
if (@args) {
push @extra
?$module\b/, \@args) );
unless (defined $success) {
require $module unless ($module ~~ @NON_INSTADIE); # death by suicide (which prints the proper error msg)
push @failed, $mo
:[A-Z]+\:(?!\:))?$module\b/, \@args) );
require $module unless (defined $success || $module !~~ @NON_INSTADIE); # death by suicide (which prints the proper error msg)
}
}
sub load_pragma {
$value = $list->index(0);
my ($key, $value) = $map->index(0);
Returns the value at the index given (zero starting). Returns a list if a map type. Returns undef or () if not present. Throws L<Th