Matcher
subset Matcher of Mu where none(Bool)
Used to supply a test to match against. Assume C<~~> will be used against it.
Booleans are forbidden because they almost always indicate a programming
e { .signature === :(Any, Any --> Int ) };
subset OrderingPair of Pair where { .left ~~ KeyExtractor && .right ~~ Comparator };
subset Ordering where Signature | KeyExtractor | Comparator | Orderin
against a type, you're likely better off
performing an C<isa> or C<does> or C<can>, or just C<$var ~~ TYPE>.
=item reset
Was there a I<good> use for this?
=item semctl, semget, semop
See IPC::SysV
/ @std_dirpath // '.';
@dirpath ^=~ s{([^/])$}{$1/};
[Update: Hyper smartmatch is now C<»~~«>.]
my %data;
foreach my $prefix (@dirpath) {
[Update: Now spelled:
for @d
any> Perl 6 subroutine. For
example:
sub mean (*@values : $type //= 'arithmetic') {
given ($type) {
when 'arithmetic': { return sum(@values) / @values; }
when 'geo
emantics.]
=item *
binary C<**>
=item *
binary C<=~> and C<!~>
[Update: Smartmatch is now C<~~>.]
=item *
binary C<*>, C</>, and C<%>
=item *
binary C<+> and C<->
=item *
binary C<< <<
|
|-----------------------------------|
| ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |~~
$comments,
===================================
.
write STDOUT;
in Perl 6 we
har><1,$width>) /;
# Squeeze the resultant substring...
(my $result = $1) ~~ s:each/ <$ws> | \v+ /\c[SPACE]/;
# Check for any more data still to come...
r:
sub expurgate (Str *@hidewords) {
return sub (Str $data is rw) {
$data ~~ s:ei/(@hidewords)/$( 'X' x length $1 )/;
return $data;
}
}
We could then
C<when> statement, because:
when $is_sheep { push @sheep, $_ }
is equivalent to:
if $_ ~~ $is_sheep { push @sheep, $_; next }
When C<$is_sheep> is a subroutine reference, that implicit sm
my $context = want;
if $context ~~ List {
my @values = block();
return { *@values };
}
elsif $context ~~ Scalar {
my $value = block();
of regular expression objects:
my @patterns = ( qr/Fr.d/, qr/B.rn.y/, qr/W.lm./ );
if( $string ~~ @patterns ) {
...
};
The smart match stops when it finds a match, so it doesn't have to try
e
is node's value : " . $node->string_value() . "\n" if $VERBOSE;
unless ( $node->string_value() ~~ $match ) {
die "XPath '$xpath' doesn't match '$match' as expected, instead it is '" . $nod
ode's value : " . $node->string_value() . "\n" if $VERBOSE;
unless ( $node->string_value() ~~ $match ) {
die "Elment $i of XPath '$xpath' doesn't match '$match' as expected, instea
"assert_xpath_value_match: This attr's value : " . $value . "\n" if $VERBOSE;
unless ( $value ~~ $match ) {
die "XPath '$xpath', attribute '$attr' doesn't match '$match' as expected, inst
b help {
say <<'OUT';
usage:
install
upgrade
current-version
OUT
}
help unless $ARGV[0];
given ( $ARGV[0] ) {
when ('install') { install() }
when ('prepare-install') {
ert{$op}
or $op eq '~~';
bless do {
($op eq '~~' or
($op =~ /[!=]=/ and ref $expect eq ref qr//))
, # == is overloaded when rhs is a regex
is 'abcd' ~~ q/bc/, # ~~ can be used with a string rhs in perl 5.10+
is 'badc' ~~ q/bc/;
test 'data structures',
is [1, 2, 3]
tatement?
In Perl 5.10, use the C<given-when> construct described in L<perlsyn>:
use 5.010;
given ( $string ) {
when( 'Fred' ) { say "I found Fred!" }
when( 'Barney' ) { say "I fo
# Check if a token is a known SQL keyword.
sub _is_keyword {
my ($self, $token) = @_;
return ~~ grep { $_ eq uc($token) } @{$self->{keywords}};
}
# Add new keywords to highlight.
sub add_keywo
required if ACC is array, otherwise omit
use Test::More tests => 9; # ~~ Test::More::*
$trap->ACC_ok ( $ix, $name ); # ok()
ate_attributes;
}
my $meta_attr = $meta->get_attribute( $attribute_name );
my $return;
given ( ref $meta_attr ) {
when( 'Moose::Meta::Role::Attribute' ) {
$return = $meta_attr->ori
f->include_standard_methods ) {
my @STOCK = qw/ DESTROY meta new /;
return if $method_name ~~ @STOCK;
}
my $extracted_method = $self->_extract_method_metainfo( $meta_method );
$self->_
my $uri = $request.uri;
my $scheme = $uri.scheme;
unless ($scheme ~~ m:P5/^https?\z/) {
#LWP::Debug::debug('Will not add cookies to non-HTTP requests');
path; # for backwards compatibility
my method normalize_path (Str $str is rw) {
given ($str) {
s:P5:g/%([0-9a-fA-F][0-9a-fA-F])/{
my $x = $0.uc;
_id;
return $self->{job_id};
}
=head2 job_status
Sends RESTful request for job status of a given (known) job_id
Sets status of the job in the client object after response is returned
=cut
sub
lt();
}
before 'run' => sub {
my ($self) = @_;
return unless ($self->auto_scale);
given (Scalar::Util::blessed($self)) {
when ('Hobocamp::Menu') {
$self->menu_height
_id;
return $self->{job_id};
}
=head2 job_status
Sends RESTful request for job status of a given (known) job_id
Sets status of the job in the client object after response is returned
=cut
sub
#!/usr/bin/perl -w
use FindBin qw($Bin);
use lib "$Bin/../lib";
$ARGV[0] ~~ m/select ([\w,]+) FROM ([^\s]+) WHERE ([^;]+);/i;
my @vars = split /,/, $1;
my $ont = $2;
my $code = $3;
foreach (@vars)
6_re \z }xms;
};
our @Boolean = qw(0 1);
subtype "${PKG}::Boolean"
=> as "Bool"
=> where {
$_ ~~ @Boolean;
};
coerce "${PKG}::Boolean"
=> from "Bool"
=> via { $_ ? 1 : 0 };
coerce "${PKG}::Dol
@AccountingAction = qw(Credit Debit);
subtype "${PKG}::token_OTHERS"
=> as "Str",
=> where { $_ ~~ @AccountingAction };
enum "${PKG}::DomainWriteAction" =>
qw(DomainCreate DomainUpdate);
enum "$
if ( $attr->has_value($instance) ) {
if ( $attr->get_value($instance) ~~ $params->{$match_attr} ) {
$match++;
}
tries, so that we can allow self-reference
foreach my $dep (@deps) {
unless(grep { $dep->name ~~ $_->name } @pending, @existing, $entity) {
logError("%s unresolved (pending %s, deps %s for %s
n(',', @deps), $entity->name);
die "Dependency error";
}
}
my @unsatisfied = grep { $_ ~~ [ map { $_->name } @deps ] } @pendingNames;
if(@unsatisfied) {
logInfo("%s has %d unsatisfied