Refinement in the query (a catch without a try? nah ), line number inches closer to reality
sub violates { my ( $self, $elem, undef ) = @_; my $globaldollar = $elem->xf(q{ //Statement::Variable /Token::Word[.='our'] /following-sibling::Token::Magic[.='$_'] }); my( $catch ) = $elem->xf(q{ .//Statement /Token::Word[ . = 'try' ] /following-sibling::Structure::Block /following-sibling::Token::Word[ . = 'catch' ] /following-sibling::Structure::Block[ contains( ., '$_' ) ] }); if( $catch and not $globaldollar ){ return $self->violation( $DESC, $EXPL, $catch ); } return; }
In reply to Re: Perl::Critic::Policy::ValuesAndExpressions:: GivenWhenTryCatchLexicalDollarUnderDefaultVarBindingConfusion
by Anonymous Monk
in thread Perl::Critic::Policy::ValuesAndExpressions:: GivenWhenTryCatchLexicalDollarUnderDefaultVarBindingConfusion
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |