view release on metacpan or search on metacpan
share/P6STD/STD.pm6 view on Meta::CPAN
}
elsif $*QSIGIL {
$¢.obs($bad, '{' ~ $sigil ~ $text ~ '}');
}
else {
$¢.obs($bad, $sigil ~ $text);
}
} # always fails, don't need curlycheck here
}
token special_variable:sym<$[> {
<sym> :: <?before \s | ',' | '=' | <terminator> >
<.obs('$[ variable', 'user-defined array indices')>
}
token special_variable:sym<$]> {
<sym> :: <?before \s | ',' | <terminator> >
<.obs('$] variable', '$*PERL_VERSION')>
}
token special_variable:sym<$\\> {
<sym> :: <?before \s | ',' | '=' | <terminator> >
<.obs('$\\ variable', "the filehandle's :ors attribute")>
share/P6STD/STD_P5.pm6 view on Meta::CPAN
}
token p5special_variable:sym<::{ }> {
'::' <?before '{'>
}
regex p5special_variable:sym<${ }> {
<sigil=p5sigil> '{' {} $<text>=[.*?] '}'
}
token p5special_variable:sym<$[> {
<sym>
}
token p5special_variable:sym<$]> {
<sym>
}
token p5special_variable:sym<$\\> {
<sym>
}
share/P6STD/boot/STD.pmc view on Meta::CPAN
- !!perl/hash:RE_block {}
special_variable__S_120DollarBra: !!perl/hash:RE_ast
dba: special_variable
dic: STD::P6
re: !!perl/hash:RE_sequence
zyg:
- !!perl/hash:RE_method
i: 0
name: sym
rest: ''
sym: $[
- !!perl/hash:RE_meta
text: '::'
- !!perl/hash:RE_assertion
assert: '?'
re: !!perl/hash:RE_method_re
name: before
nobind: 1
re: &93 !!perl/hash:RE_any
altname: special_variable__S_120DollarBra_0
dba: special_variable
share/P6STD/boot/STD.pmc view on Meta::CPAN
})
}))
} else { () }
},
$C->_SUBSUME(['sigil'], sub {
my $C = shift;
$C->sigil
})));
}
;
## token special_variable:sym<$[> {
sub special_variable__S_120DollarBra__PEEK { $_[0]->_AUTOLEXpeek('special_variable__S_120DollarBra', $retree) }
sub special_variable__S_120DollarBra {
no warnings 'recursion';
my $self = shift;
local $::CTX = $self->callm() if $::DEBUG & DEBUG::trace_call;
my $C = $self->cursor_xact("RULE special_variable__S_120DollarBra");
my $xact = $C->xact;
share/P6STD/boot/STD.pmc view on Meta::CPAN
)[$try])->($C);
last if @gather;
last if $xact->[-2]; # committed?
}
@gather;
};
})) { ($C) } else { () }
}))) { ($C) } else { () }
}))
and ($C) = ($C->obs('$[ variable', 'user-defined array indices'))) {
$C
} else { () }
});
}
;
## token special_variable:sym<$]> {
sub special_variable__S_121DollarKet__PEEK { $_[0]->_AUTOLEXpeek('special_variable__S_121DollarKet', $retree) }
sub special_variable__S_121DollarKet {
no warnings 'recursion';
share/PerlCritic/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm view on Meta::CPAN
}
sub default_severity { return $SEVERITY_MEDIUM }
sub default_themes { return qw(core pbp maintenance) }
sub applies_to { return 'PPI::Token::Magic' }
#-----------------------------------------------------------------------------
sub violates {
my ($self, $elem, $doc) = @_;
# TODO named capture variables
return if $elem !~ m/\A \$[1-9] \z/xms;
return if _is_in_conditional_expression($elem);
return if $self->_is_in_conditional_structure($elem);
return $self->violation( $DESC, $EXPL, $elem );
}
sub _is_in_conditional_expression {
my $elem = shift;
# simplistic check: is there a conditional operator between a match and
# the capture var?
share/PerlCritic/Critic/Policy/Variables/ProhibitEvilVariables.pm view on Meta::CPAN
option_value => $arguments{option_value},
message_suffix =>
qq{contains an invalid regular expression: "$regex_string"};
# Can't use a hash due to stringification, so this is an AoA.
push
@{ $self->{_evil_variables_regexes} ||= [] },
[ $actual_regex, $description ];
}
else {
# These are literal variable names (e.g. $[)
$self->{_evil_variables} ||= {};
my $name = $arguments{variable};
$self->{_evil_variables}{$name} = $description;
}
return;
}
#-----------------------------------------------------------------------------
share/PerlCritic/Critic/Policy/Variables/ProhibitEvilVariables.pm view on Meta::CPAN
=head1 CONFIGURATION
The set of prohibited variables is configurable via the C<variables> and
C<variables_file> options.
The value of C<variables> should be a string of space-delimited, fully
qualified variable names and/or regular expressions. An example of
prohibiting two specific variables in a F<.perlcriticrc> file:
[Variables::ProhibitEvilVariables]
variables = $[ $^S $SIG{__DIE__}
If you prohibit an array or hash (e.g. C<@INC>), use of elements of the array
or hash will be prohibited as well. If you specify a subscripted variable (e.g.
C<$SIG{__DIE__}>), only the literal subscript specified will be detected. The
above <.perlcritic> file, for example, will cause C<perlcritic (1)> to detect
C<$SIG{__DIE__} = \&foo>, but not
my $foo = '__DIE__';
$SIG{$foo} = \&foo;
share/PerlCritic/Critic/Policy/Variables/ProhibitEvilVariables.pm view on Meta::CPAN
variables = /(?i:acme)/
forbids variables that match C<m/acme/smi>.
In addition, you can override the default message ("Prohibited variable
"I<variable>" used") with your own, in order to give suggestions for
alternative action. To do so, put your message in curly braces after
the variable name or regular expression. Like this:
[Variables::ProhibitEvilVariables]
variables = $[ {Found use of $[. Program to base index 0 instead}
If your message contains curly braces, you can enclose it in parentheses,
angle brackets, or square brackets instead.
Similarly, the C<variables_file> option gives the name of a file
containing specifications for prohibited variables. Only one variable
specification is allowed per line and comments start with an octothorp
and run to end of line; no curly braces are necessary for delimiting
messages:
$[ # Prohibit the "$[" variable and use the default message.
# Prohibit the "$^S" variable and give a replacement message.
$^S Having to think about $^S in exception handlers is just wrong
# Use a regular expression.
/acme/ No coyotes allowed.
By default, there are no prohibited variables, although I can think of a
few that should be. See C<perldoc perlvar> for a few suggestions.
=head1 RESTRICTIONS
Variables of the form C<${^foo}> are not recognized by PPI as of version
1.206. When PPI recognizes these, this policy will Just Work for them too.
Only direct references to prohibited variables and literal subscripts will be
recognized. For example, if you prohibit $[, the first line in
my $foo = \$[;
$$foo = 1;
will be flagged as a violation, but not the second, even though the second, in
fact, assigns to $[. Similarly, if you prohibit $SIG{__DIE__}, this policy
will not recognize
my $foo = '__DIE__';
$SIG{$foo} = sub {warn 'I cannot die!'};
as an assignment to $SIG{__DIE__}.
=head1 NOTES
share/PerlCritic/Critic/Policy/Variables/ProhibitPunctuationVars.pm view on Meta::CPAN
# This list matches the initialization of %PPI::Token::Magic::magic.
## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars)
Readonly::Array my @MAGIC_VARIABLES =>
qw{
$1 $2 $3 $4 $5 $6 $7 $8 $9
$_ $& $` $' $+ @+ %+ $* $. $/ $|
$\\ $" $; $% $= $- @- %- $)
$~ $^ $: $? $! %! $@ $$ $< $>
$( $0 $[ $] @_ @*
$^L $^A $^E $^C $^D $^F $^H
$^I $^M $^N $^O $^P $^R $^S
$^T $^V $^W $^X %^H
$::|
},
q<$}>,
q<$,>,
q<$#>,
share/PerlCritic/Critic/Policy/Variables/RequireNegativeIndices.pm view on Meta::CPAN
return _symbol($expr);
}
return;
}
sub _arrayindex {
# return (varname, isref=0|1, isindex=0|1) if this could be a violation
my ( $expr ) = @_;
my $arrindex = shift @{$expr};
if ($arrindex->content =~ m/\A \$[#] (.*) \z /xms) { # What else could it be???
return $1, 0, 1;
}
return;
}
sub _cast {
# return (varname, isref=0|1, isindex=0|1) if this could be a violation
my ( $expr ) = @_;
my $cast = shift @{$expr};
if ( $cast eq q{$#} || $cast eq q{@} ) { ## no critic(RequireInterpolationOfMetachars)
share/RegexpCommonTS/t/comment/single_line.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
use lib "blib/lib";
use Regexp::Common qw /RE_comment_ALL/;
use t::Common qw /run_new_tests ww/;
BEGIN {$^W = 0 if $[ < 5.006};
use warnings;
# 1. List of tokens.
# 2. List of languages.
my @data = do {
no warnings;
(
{start_tokens => ["\\"], # No qw here, 5.6.0 parses it incorrectly.
share/RegexpCommonTS/t/comment/single_or_multiline.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
use lib "blib/lib";
use Regexp::Common qw /RE_comment_ALL/;
use t::Common qw /run_new_tests ww/;
use warnings;
BEGIN {$^W = 0 if $[ < 5.006;}
# 1. tokens for single line comments.
# 2. start/end tokens for multi-line comments.
# 3. list of languages this applies to.
my @data = do {
no warnings;
(
[[qw {//}] =>
share/RegexpCommonTS/t/number/integer.t view on Meta::CPAN
"--sep-$base-$group",],
fail => [ "sep-$base-$too_long",
"+-sep-$base-$too_long",
"--sep-$base-$too_long",
"small_garbage"],
};
# Fail if the base is upped.
next if $i == $#bases;
my $next_base = $bases [$i + 1];
push @{$tests [-1] {fail}} => "sep-$next_base-$group"
unless $[ < 5.00503;
}
push @tests => {
name => "-base=$base; -sep; " .
"-group=$group_sizes[0],$group_sizes[-1]",
re => $RE {num} {int}
{-base => $base}
{-group => "$group_sizes[0],$group_sizes[-1]"}
{-sep},
sub => \&RE_num_int,
share/SpamAssassin/easy_ham/01133.d9329be5511d9ba5af54e36ce4cb3777 view on Meta::CPAN
Received: from loverso.southborough.ma.us (localhost [127.0.0.1]) by
schooner.loverso.southborough.ma.us (8.12.3/8.11.3) with ESMTP id
g8OI8LM8068943; Tue, 24 Sep 2002 14:08:21 -0400 (EDT) (envelope-from
loverso@loverso.southborough.ma.us)
Message-Id: <200209241808.g8OI8LM8068943@schooner.loverso.southborough.ma.us>
To: Ted Cabeen <secabeen@pobox.com>
Cc: exmh-workers@spamassassin.taint.org
Subject: Re: Minor feature request
In-Reply-To: Message from Ted Cabeen <secabeen@pobox.com>
<20020924170024.1935256D@gray.impulse.net> .
X-Face: "UZ!}1W2N?eJdN(`1%|/OOPqJ).Idk?UyvWw'W-%`Gto8^IkEm>.g1O$[.;~}8E=Ire0|lO
.o>:NlJS1@vO9bVmswRoq3j<A2*d2*S+2%tyPf2|dwcrNgSx%#^d@7'85{"$i2,xw/T,I<]R$FG"{>
DdX9YGSeJ5a(mfX[1u>Z63G5_^+'8LVqjqvn
X-Url: http://surf.to/loverso
From: "John R. LoVerso" <john@loverso.southborough.ma.us>
X-Loop: exmh-workers@spamassassin.taint.org
Sender: exmh-workers-admin@spamassassin.taint.org
Errors-To: exmh-workers-admin@spamassassin.taint.org
X-Beenthere: exmh-workers@spamassassin.taint.org
X-Mailman-Version: 2.0.1
Precedence: bulk
share/SpamAssassin/easy_ham_2/00445.4222549eadcf376d1f15942391cf806d view on Meta::CPAN
> status of a command without using $? i.e. can I do something like
>
> result = some_magic_way_of_quoting(command)
>
> instead of
>
> command
> result=$?
>
> Note that I'm not looking for backtick or $() substitution, nor arithmetic
> evaluation as with $[]
I don't think this is possible.
thanks,
Pádraig.
--
Irish Linux Users' Group: ilug@linux.ie
http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.