s .= "($_->[1])" if defined $_->[1]; # add layer encoding
$layers .= ':utf8' if 'UTF8' ~~ $_->[2]; # add :utf8 layer, if defined
}
my $fileno = eval { fileno $_[0] };
pu
say q[You forgot to specify release version];
return;
}
if ( "$new_ver" ~~ $self->{dist}->releases ) {
say qq[Version $new_ver is already released];
return;
to ambiguity of tilde C<~> character as used for bitwise negation operator, smartmatch operator C<~~>, or regular expression C<=~>
~(-8) # 7
~(-2) #
r>
#!/usr/bin/env perl
# Learning RPerl, Chapter 6, Exercise 1
# Accept one input given (first) name, and print the corresponding family (last) name
# [[[ HEADER ]]]
use RPerl;
barney => 'rubble',
wilma => 'flintstone'
};
print 'Please input a given (first) name in all lowercase, then press <ENTER>:', "\n";
my string $given_name = <STDIN
#!/usr/bin/env perl
# Learning RPerl, Chapter 6, Exercise 1
# Accept one input given (first) name, and print the corresponding family (last) name
# [[[ HEADER ]]]
use RPerl;
use strict;
use warnings
ne',
barney => 'rubble',
wilma => 'flintstone'
};
print 'Please input a given (first) name in all lowercase, then press <ENTER>:', "\n";
my string $given_name = <STDIN>;
or (not defined $names->{$given_name})) {
croak 'ERROR: No family (last) name found for given (first) name ', $given_name, ', croaking', "\n";
}
print 'The family (last) name of ', $
$self = $type;
$type = $self->{type};
}
croak "Invalid type '",$type,"' given (should be one of ",join(" ",keys %$TYPES),")" unless $TYPES->{$type};
# Hash comes afte
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
# if (, elsif (, unless (, while (, until (, given (, and when (
# given, when
# P.225 The given Statement
# in Chapter 15: Smart Matc
Operators
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
# ~~
# P.221 The Smart Match Operator
# in Chapter 15: Smart Matching and given-when
# of
-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
elsif (/\G ((?>
!~~ | !~ | != | ! |
%= | % |
&&= | && | &= | &\.= | &\. | & |
-= |
|ARRAY
[0.26] Alternative host components which indicate the same virtual host. When
'AUTO' is given (the default since [0.28]), then L<generateAliases()|Any::Daemon::HTTP::VirtualHost/"Attributes">
ce, C<< 'foo' ~~ $nameset >> invokes
C<< $nameset->contains('foo') >>. This is inspired by the Raku behaviour,
in which C<< $x ~~ $y >> calls C<< $y.ACCEPTS($x) >>
NOTE: C<< $nameset ~~ 'foo' >> (ob
far as I can tell, even 5.27.7 would have supported the
C<< 'foo' ~~ $nameset >> form.
=cut
use overload
fallback => 1,
'~~' => sub {
#my ($self, $other, $swap) = @_;
$_[0]-
atch)} ]);
}
sub opt_type_atom {
my $atom = shift;
my ($name,$value) = flat($atom);
given ($name) {
when ('Spec') {
return opt_type_spec($value);
}
when ('More') {
_atom {
my ($rule,$t) = @_;
my ($name,$atoms) = flat($rule);
if (not($name ~~ ['Str','End'])) {
given ($name) {
when ('Rules') {
lint_type_atoms($atoms,$t);
}
rule);
}
sub match_type_rule {
my ($t,$rule) = @_;
my ($name,$value) = flat($rule);
given ($name) {
when ('Rules') {
return match_type_rules($t,$value);
}
when ('Bra
ew( [$hashref] )
Create and return a new empty L<SVN::Dump::Headers> object.
If C<$hashref> is given (it can be a blessed hash reference), the
keys from the hash are used to initialise the headers.
ts = grep { $_ eq 'foo' } @ary;
Another alternative is using smartmatch:
my $foo_exists = 'foo' ~~ @ary;
but smartmatch is now in experimental status and might be removed in the future.
Plus the a
->{$rule->long} = []
if $rule->is_list && !defined $self->{'options'}->{$rule->long};
given($rule->type) {
when('s') {
}
when('i') {
$self->error('Argument "%s" to "-
$self->error('Value "%s" to argument "--%s" is invalid.', $arg, $rule->long)
unless $arg ~~ @{$rule->values || []};
}
}
if ($rule->is_list) {
if ('?' ne $rule->type) { ##
{
push @{$self->{'options'}->{$rule->long}}, $arg
unless ($rule->keep_unique && $arg ~~ @{$self->{'options'}->{$rule->long}});
}
$rule->mark_used;
next PROCESS_ARGUMENTS
add_to) {
push @needs_add, $_ unless $_ ~~ $cur_groups;
}
for (@$del_from) {
push @needs_del, $_ if $_ ~~ $cur_groups;
}
if (@needs_add ||
ess $group ~~ @$member_of;
my $not_member_of = $args{not_member_of} // [];
for (@$member_of) {
return [400, "Group $_ is in member_of and not_member_of"]
if $_ ~~ @$not_mem
if $l->{group} ~~ @$member_of && !($user ~~ @mm);
push @needs_del, $l->{group}
if $l->{group} ~~ @$not_member_of && ($user ~~ @mm);
}
[$n+1],0,$ds) eq substr($x[$n],0,$ds); #hm
croak "Could not resolve, perhaps too little time given ($sec), iteratons=$n"
if $sec>0 and ($Resolve_time=time_fp()-$time_start)>$sec;
#warn "
# 0
print in( 'a', 'A','B','C','a'); # 1
I guess in perl 5.10 or perl 6 you could use the C<< ~~ >> operator instead.
=head2 in_num
Just as sub L</in>, but for numbers. Internally uses the perl
my @valid_lists = sort($mpd->collection->all_playlists);
for my $list(@lists) {
if($list ~~ @valid_lists) {
next;
}
else {
my @choices = ();
for my $valid(@valid_l
ices;
}
elsif($answer eq 'current') {
return(undef);
}
if($answer ~~ @valid_lists) {
$list = $answer;
}
# Make sure the number selected is in fact
s = @_;
my @lists = $mpd->collection->all_playlists;
map { s/^\s+//m } @lists;
return ($_[0] ~~ @lists) ? 1 : 0;
}
sub escape {
my $str = shift;
$str =~ s/([;<>*|`&\$!#()[\]{}:'" ])/\\$1/g;
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
# if (, elsif (, unless (, while (, until (, given (, and when (
# given, when
# P.225 The given Statement
# in Chapter 15: Smart Matc
Operators
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
# ~~
# P.221 The Smart Match Operator
# in Chapter 15: Smart Matching and given-when
# of
-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
elsif (/\G ((?>
!~~ | !~ | != | ! |
%= | % |
&&= | && | &= | &\.= | &\. | & |
-= |
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
# if (, elsif (, unless (, while (, until (, given (, and when (
# given, when
# P.225 The given Statement
# in Chapter 15: Smart Matc
Operators
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
# ~~
# P.221 The Smart Match Operator
# in Chapter 15: Smart Matching and given-when
# of
-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
elsif (/\G ((?>
!~~ | !~ | != | ! |
%= | % |
&&= | && | &= | &\.= | &\. | & |
-= |
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
# if (, elsif (, unless (, while (, until (, given (, and when (
# given, when
# P.225 The given Statement
# in Chapter 15: Smart Matc
Operators
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
# ~~
# P.221 The Smart Match Operator
# in Chapter 15: Smart Matching and given-when
# of
-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
elsif (/\G ((?>
!~~ | !~ | != | ! |
%= | % |
&&= | && | &= | &\.= | &\. | & |
-= |
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
# if (, elsif (, unless (, while (, until (, given (, and when (
# given, when
# P.225 The given Statement
# in Chapter 15: Smart Matc
Operators
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
# ~~
# P.221 The Smart Match Operator
# in Chapter 15: Smart Matching and given-when
# of
-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
elsif (/\G ((?>
!~~ | !~ | != | ! |
%= | % |
&&= | && | &= | &\.= | &\. | & |
-= |
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
# if (, elsif (, unless (, while (, until (, given (, and when (
# given, when
# P.225 The given Statement
# in Chapter 15: Smart Matc
Operators
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
# ~~
# P.221 The Smart Match Operator
# in Chapter 15: Smart Matching and given-when
# of
-0-596-00492-7 Programming Perl 4th Edition.
# (and so on)
elsif (/\G ((?>
!~~ | !~ | != | ! |
%= | % |
&&= | && | &= | &\.= | &\. | & |
-= |