operator, C<~~>, can be used in a variety of situations. Here
are a few examples:
say "Yep" if $banana ~~ @fruits; # is the element is present in the array?
exit if $error ~~ %fatal;
# is the key present in the hash?
function() if $condition ~~ True # is the condition true?
%my_hash ~~ %their_hash # do the hashes have the same keyes?
Smart matching is
$a ~~ /foo/ { ... } # true if $a contains "foo"
The C<//> matching operator is documented in L<doc:perlop>. It operators on
C<$_> by default, or can be bound to another variable using the C<~~>
($retval->{xen_package}) = grep { m!repository/packages/xen/builds! } @{ $precondition ~~ dpath '/host/preconditions//filename' };
push @{$retval->{test}}, get_test
cility.
=head2 get_test_list_from_precondition
Utility function to extract testprograms from a given (sub-) precondition.
=head2 get_testrun_overview
This function reads and parses all preconditio
s = ['group', 'matrix', 'cube', 'hypercube']; # if you go past here, you've gone too far...
given (reftype $tree) {
# Common code for both HASHs and ARRAYs
when (/HASH|ARRAY/) {
# and all foreign keys that refer to it.
elsif ($pkey) { $fk_list = [ grep { $colnames->{$_} ~~ /^$pkey$/ } keys %$colnames ]; }
# If only FKT is given, then the result set contains all fore
a; # ( c ) ~~ after {/b/} (a, b, c)
@gots = after_incl {$_} @a; # ( b, c ) ~~ after_incl {/b/} (a, b, c)
@gots = before {$_} @a; # ( a ) ~~ before {/b/
b, c)
@gots = before_incl {$_} @a; # ( a, b ) ~~ before_incl {/b/} (a, b, c)
@gots = indexes {$_} @a; # ( 1 ) ~~ indexes {/b/} (a, b, c)
$got = firstval {
ts)
# Seen-hash: Use hashrefs instead of arrayrefs:
# [ 11, 12, 14, 14, 14, 15 ] ~~ { 11 => 1, 12 => 1, 14 => 3, 15 => 1 }
#
# Construct a work-object
my $lc = Li
'.$now if ( 'created_at' ~~ [ $self->app->model->resultset( $self->{resource} )->result_source->columns ] );
$self->{_payload}->{updated_at} = ''.$now if ( 'updated_at' ~~ [ $self->app->model->res
my $now = DateTime->now ;
$self->{_payload}->{updated_at} = ''.$now if ( 'updated_at' ~~ [ $self->app->model->resultset( $self->{resource} )->result_source->columns ] );
}
1;
__END__
=p
>distributions($id);
my $kwalitee = $authors->kwalitee($id);
print "$name has published ", ~~ @dists, " distributions:\n";
@dists = sort { lc($a->dist) cmp lc($b->dist) } @dists;
for m
) {
print ( $v->{time} - $t ) . ": $v->{value}\n"
# Or with human-readable times
# print ~~ localtime ( $v->{time} - $t ) . ": $v->{value}\n"
}
=head1 AUTHOR
Luke Poskitt, C<< <ltp at cp
st operators
nonassoc < > <= >= lt gt le ge
nonassoc == != <=> eq ne cmp ~~
left &
left | ^
left &&
left |
now 0
my $z = "c" cmp "b"; #$x is now positive
=head3 See also
L</X E<lt>=E<gt> Y>
=head2 X ~~ Y
=head3 Class
This belongs to L<perlop/Equality Operators>.
=head3 Description
This is the sm
ead.
=head3 Example
See L<perlsyn/"Smart matching in detail"> for examples.
=head3 See also
L</~~X>, L<perlsyn/"Smart matching in detail">, and L<perlfunc/scalar>
=head2 X & Y
=head3 Class
This
=~ s/[-\W]/_/g;
$name;
}
func _range($val, $dent) {
my $ret = "";
$ret .= '[';
given ( $val->{type} ) {
when ( 'hex' ) {
$ret .= join('-', map { '\x{' . $_ . '}' } $val->{min},
lue} \n";
}
}
$ret .= "]";
$ret;
}
func _string($val, $dent) {
my $ret = "";
given ( $val->{type} ) {
when ( 'hex' ) {
$ret = join('', map { '\x' . $_ } @{$val->{value}});
enerateChain>.
Uses in generate call to stringify chains.
=cut
func _asStrings($generated) {
given ( $generated->{class} ) {
when ( "Atom" ) { return [ $generated->{value} ] }
when ( "Sequenc
rgument with the
# property value.
#
# Return a sorted list of all property names if no argument given (the
# list may be empty).
# -----------------------------------------------------------------
su
$file = $next_file->() ) ) {
my $mtime = stat($file)->mtime;
if ( ( !$force ) and $mtime ~~ $mtimes{$file} ) {
next;
}
my $perlcritic = "perlcritic $ARGV{-C} $file";
e ( defined( my $file = $next_file->() ) ) {
my $mtime = stat($file)->mtime;
if ( $mtime ~~ $mtimes{$file} ) {
next;
}
my $perltidy = "perltidy $ARGV{-P} $file";
if
sub english_to_num {
my ( $class, $width, $style ) = @_;
given ( lc $style ) {
when ('solid') {
given ($width) {
when (0) { return 7; }
wh
default { return 7; }
}
}
when ('dash') {
given ($width) {
when (1) { return 3; }
when (2) { return 8; }
default { return 9; }
}
}
when ('dash dot dot') {
given ($width) {
when (1) { return 11; }
when (2) { return 12; }
#################################################
=item B<findInPath> - locate all files with a given (normalized) name
@list = $obj->findInPath($a_file_name);
Example:
@time_h = $includes
###########################################
=item B<findFirstInPath> - locate first file with a given (normalized) name
@list = $obj->findFirstInPath($a_file_name);
Example:
$includes2 =
#############################################
=item B<findBestInPath> - locate best file with a given (normalized) name
@list = $obj->findBestInPath($a_file_name,
$reference_to_comparison_f
lse { }
< > <= >= lt gt le ge unless (e) { } elsif (e) { } else { }
== != <=> eq ne cmp ~~ given (e) { when (e) {} default {} }
&
| ^ METACARACTERES EXP. REG. MODIFICADORES
er!" unless $_[0] ~~ [0..100] },
lazy => 1,
builder => '_build_cores',
);
option add_one => (
is => 'rw',
isa => sub { die "Invalid bool!" unless $_[0] ~~ [ 0 .. 1 ] },
q{add one to the number of cores (useful in scripts)},
);
sub _build_cores {
do {
given ($_[0]->os) {
when ('darwin') { $_ = `sysctl hw.ncpu | awk '{print \$2}'`; chomp;
= shift;
my $main = $self->main;
my $config = $main->config;
my $output = $main->output;
given ( $self->user_name->GetStringSelection() ) {
when ('nick') {
$self->name_label->SetLabel( 'u
#######
# Event Handler Button Warning Clicked
#######
sub clean_clicked {
my $self = shift;
given ( $self->relation_name ) {
when ('DebugBreakpoints') {
clean_debug_breakpoints_files($self)
#####
# Composed Method
# _display_relation
#######
sub _display_relation {
my $self = shift;
given ( $self->relation_name ) {
when ('DebugBreakpoints') {
$self->clean->Enable;
_display_any
{
my $name = add_value($valuesR, shift @$inputR);
push @expressions, "\$para->format_name ~~ $name";
} # end if specific format(s) listed
join_expressions(and => \@expressions);
} # end
{
my $name = add_value($valuesR, shift @$inputR);
push @expressions, "\$para->command ~~ $name";
} # end if specific command(s) listed
join_expressions(and => \@expressions);
}
shift @$inputR // croak "-content requires a value");
"\$para->content ~~ $name";
}, #end -content
-region => \®ion_action,
-podregion => sub { region_ac