/ @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();
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
ub arguments_checking {
my ($self,$provider_name,$config) = @_;
# version 1 checking
given ( $config->{version} ) {
when(2) {
for( $self->version2_required ) { die "P
) = @_; # env and provider id
my $config = $self->providers->{ $provider };
my $class;
given( $config->{version} ) {
when (2) { $class = 'Plack::Middleware::OAuth::Handler::RequestTo
($self,$env,$provider) = @_;
my $config = $self->providers->{ $provider };
my $class;
given( $config->{version} ) {
when (2) { $class = 'Plack::Middleware::OAuth::Handler::AccessTok
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]
>: optional integer, if present, will truncate the message payload if it is larger than the size given (in bytes)
=back
my $a = Net::RabbitMQ::Management::API->new( url => 'http://localhost
=> $cron_event,
cb => $cb,
%args
});
}
catch {
given ( $timespec ) {
# hour:minute per day
when( m{^(\d+):(\d+)$} ) {
not valid Apache2 Listen directive syntax" };
subtype ApacheLogLevel,
as Str,
where { $_ ~~ @apache_log_levels },
message { "$_ is not a valid Apache2 log level. Must be one of " . join(
my ($to, $port);
for(keys %$args) {
$to = $args->{$_} if $_ eq 'to';
}
given(lc $service) {
when ('ssh') { $port = 22; }
when ('www') { $port = 80; }
s = 0;
my @flush_items;
if (ref $opts eq 'ARRAY') {
for (@{$opts}) {
given (uc $_) {
when ('INPUT') { push @flush_items, $_; }
when ('OUTPUT
ent});
}
}
sub _to_add_in {
my ($seq, $letters_aref) = @_;
return ($seq->text_to_add ~~ $letters_aref);
}
{
# Dagesh qal.
# BET and PE must not change according to these rules i
x' is out of range.";
}
if (
not $self->_letter($let_idx)
~~ @{ $sets_seq->[$i] })
{
return;
}
}
return 1;
}
sub safe_mat
$v = shift @{$_[0]}; # Field initializer
next unless USB::HID::Report::Field->can($k);
given( ref($v) )
{
when('HASH') { push @fields, USB::HID::Report::Field->$k(%{$v}); }
when('AR
g;
my @letters ;
# filter input
$num =~ s/\D+//;
for (split //, $num ) {
given (lc $_) {
when ('2') { push @letters, [qw/a b c/] }
when ('3') { p
,
#actions => [qw/ fix /] ,
} ,
;
1;
DEBUG 'Scanning '. BASE ;
given (ACTION) {
when (/^add$/i) { disable_test_builder;
write_LICENSE BASE ,
iptor item
# Expects the tag name followed by the data bytes
sub item
{
my $tag = shift;
given($tag)
{
# Handle Main items
when( 'collection' )
{
my $type = shift;
push @_, $c
ize(@_)), @_);
}
# Return an item's type given its tag
sub item_type
{
my $tag = shift;
given( $tags{$tag} & 0x0C )
{
when( 0x00 ) { return 'main' }
when( 0x04 ) { return 'global' }
wh
sub to_digits {
my $alphanum = lc shift;
my $res;
for (split //, $alphanum ) {
given ( $_) {
when (/[abc]/) { $res .= '2'}
when (/[def]/) { $res .= '3'}
>BASE, dirs=> DIRS } ,
;
my @dirs = map { BASE .'/'. $_ } @{DIRS()} ;
DEBUG "Scanning @dirs ";
given (ACTION) {
when (/^add$/i) { my $msg = howl_notice($opts->{copyright} ) ;
DEBUG 'Using c
1;
}
} else {
$options{'Indexes'} = 1;
}
my @aliases = ' ScriptAlias ~~apache-virtualserver-cgidir~~';
if ($vserver->{'apache-virtualserver-enable-ssi'}) {
unshift(@index, 'welco
lHost ~~apache-virtualserver-name~~~~apache-server-port~~>
ServerName ~~apache-virtualserver-name~~
ServerAdmin ~~apache-virtualserver-admin~~
DocumentRoot ~~apache-virtualserver-pagedir~~
Cus
mLog ~~apache-virtualserver-logdir~~ combined
~~apache-virtualserver-index~~
~~apache-virtualserver-aliases~~
<Directory ~~apache-virtualserver-pagedir~~>
~~apache-virtualserver-options~~
</
# 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