sub read_packet_chunk { #{{{
my ( $self, $first_bit ) = @_;
my ($packet_string);
given ($first_bit) {
when (/[\x70-\x7f]/) {
my $length = unpack "C*", $first_bit;
= keys %{$hessian_data};
my $datastructure = $hessian_data->{ $keys[0] };
given ( $keys[0] ) {
when (/call/) {
$hessian_message = $self->write_hessia
id => $self->_request->get_cookie(name => 'session_id'));
if (!($self->_session->get_id() ~~
$self->_request->get_cookie(name => 'session_id'))) {
$self->_response->set_cook
ed $data_hash->{'input_type_list'} and
not $data_hash->{'input_type_list'} ~~
$self->{'input_type_list'}) {
next;
r of elements). If C<$fields> is specified, the resulting document
will only include the fields given (and the C<_id> field) which can cut down on
wire traffic.
=head2 insert ($object, $options?)
y $i = 0; $i <= $#token; $i++ ) {
foreach ( $token[$i] ) {
if ( $preserve_caps ~~ q(1)
&& m{^\p{Lu}+(?:\N{APOSTROPHE})?$}msx )
{
next;
push @{$testrun{image}}, @{ $description ~~ dpath '/preconditions/*/mount[value eq "/"]/../image' };
push @{$testrun{image}}, @{ $description ~~ dpath '//root/precondition_type[value eq "a
];
}
my @testplan_elements;
foreach my $plan (@plans) {
given ($plan->{type})
{
when(['multitest', 'testrun']) { push
e given but it's too much typing.
=head1 SYNOPSIS
use Acme::Given::Hash;
my $result = $given ~~ gvn { $value1 => $scalar
, $value2 => do { ... }
} || $default ;
# is going to result in the same thing as:
my $result;
given($given) {
when ($value1) { $result = $scalar }
when ($value2) { $result = do{ ... }}
= $default }
};
# if you use an arrayref you can do more complex matching
$result = $given ~~ gvn [ 'scalar' => 'still works, just like the hash'
, qr{reg} => [qw{al
um where { $^n % 2 == 0 }
my Str_not2b $hamlet;
$hamlet = 'isnt'; # Okay because 'isnt' ~~ /^[isnt|arent|amnot|aint]$/
$hamlet = 'amnt'; # Bzzzzzzzt! 'amnt' !~ /^[isnt|arent|amnot|a
use Rules::Common :profanity;
multi sub mesg (Str where /<profanity>/ $mesg is copy) {
$mesg ~~ s:g/<profanity>/[expletive deleted]/;
print $MESG_LOG: $mesg;
}
multi sub mesg (Str $mes
sures too. These means the same thing:
use Dog-{$^ver ~~ 1.2.1 | 1.3.4}-{$^auth ~~ /:i jrandom/};
use Dog-{$^ver ~~ Any}-{$^auth ~~ /^cpan\:/}
In any event, however you select the module, i
ector on
the right. Our example is roughly equivalent to this closure:
{ $_.does(Str) and $_ ~~ /^[isnt|arent|amnot|aint]$/; }
except that a subtype knows when to call itself.
A subtype is not
ot2b $hamlet;
$hamlet = 'isnt'; # Okay because 'isnt' ~~ /^[isnt|arent|amnot|aint]$/
$hamlet = 'amnt'; # Bzzzzzzzt! 'amnt' !~~ /^[isnt|arent|amnot|aint]$/
my EvenNum $n;
$n = 2;
:Common :profanity;
multi sub mesg ($mesg of Str where /<profanity>/ is copy) {
$mesg ~~ s:g/<profanity>/[expletive deleted]/;
print $MESG_LOG: $mesg;
}
multi sub mesg ($
'$lang'" unless exists $self->{languages}->{$lang}->{match}->{True};
return true if ($to_test ~~ $self->{languages}->{$lang}->{match}->{True});
return false;
}
sub _looks_false {
my $sel
'$lang'" unless exists $self->{languages}->{$lang}->{match}->{False};
return true if ($to_test ~~ $self->{languages}->{$lang}->{match}->{False});
return false;
}
1;
__END__
=pod
=encoding
$isGap = $stock->is_gap (SEQNAME, $colNum)
Return true if a given (SEQNAME,column) co-ordinate is a gap.
=cut
# Return true if a given (rowname,column) co-ordinate is a gap
sub is_gap {
my ($se
emplate::Element',
'BASE' => 'Excel::Template::Base',
);
my %isBuildable = map { $_ => ~~1 } qw(
WORKBOOK WORKSHEET
FORMAT BOLD HIDDEN ITALIC LOCKED OUTLINE SHADOW STRIKEOUT
IF
or '$class' ($filename) because $@\n";
}
$Loaded{$class} = ~~1;
}
return ~~1;
}
}
{
my @param_names = qw(name class isa);
sub register
{
rams{class} );
$Manifest{$name} = $params{class};
$isBuildable{$name} = ~~1;
return ~~1;
}
}
sub _create
{
my $self = shift;
my $name = uc shift;
return unl
}
grep_subfields { (tag) ~~ $sspec }
} grep_fields { (tag) ~~ $fspec }
# TODO: Benchmark: is it really faster ?
# map_fields {
# if ( (tag) ~~ $fspec ) {
# map_s
ubfields {
# if ( (tag) ~~ $sspec ) {
# with_value { $code->() }
# } else { () }
# }
# } else { () }
# } $rec
}
sub marawk (&$) {
my $code =
gin>
=back
=cut
sub new {
my $class = shift;
my @def;
if(ref $_[0] ~~ 'HASH') {
@def = %{$_[0]};
} elsif(ref $_[0] ~~ 'ARRAY') {
@def = @{$_[0]};
} else {
@def = @_;
}
my $self = ble
$self = bless { }, $class;
my $args = shift;
my @spec;
if(ref $args ~~ 'HASH') {
push @spec, %$args;
} elsif(ref $args ~~ 'ARRAY') {
push @spec, @$args;
} else {
die "no idea what $args is
$self = bless { }, $class;
my $args = shift;
my @spec;
if(ref $args ~~ 'HASH') {
push @spec, %$args;
} elsif(ref $args ~~ 'ARRAY') {
push @spec, @$args;
} else {
die "no idea what $args is
tType = ucfirst($type) eq $type;
if(ref $spec ~~ 'ARRAY') {
$self->$meth->push($extType ? $type->new($_) : $_) foreach @$spec;
} elsif(ref $spec ~~ 'HASH') {
# FIXME wrong if $extType is not se
= $self;
$sub->($self, @_);
die "Fork within transaction is not recommended" unless $self->pid ~~ $$;
if($level) {
logDebug("Commit to level %d", $level);
$self->dbh->do("release tran_" .
to reuse existing handles.
=cut
sub _fork_guard {
my $self = shift;
return $self if $self->pid ~~ $$;
logError("Fork inside a transaction (level %d), old pid %d, new pid %d", $self->transactionLe
data => 122,
}
],
}
);
$cucumber->Given(
qr/^(.+),.+entered (\d+)/ => sub {
my $c = shift;
my $subj
$num = $2;
$c->{$key} = $num;
$c->Log($subject);
}
)->Given(
qr/^(.+),.+entered number of/ => sub {
my $c = shift;
my $
}
]
)
->Given(...)
->Then(...)
->Test;
=head2 Scenarios
Create a cucumber with a plain array list of scenarios
Test::Cucumber::Tiny->Scenarios(
{ ... }
)
->Given(...)
->When(..
*remove_values = \&remove_value;
=head2 remove_pair(%pairs), remove_pairs(%pairs)
Remove all given (key, value) pairs from the multiset.
=cut
sub remove_pair {
my ($self, %pairs) = @_;
w