Subject: | Utils precedence_of() on filetest -f etc |
Date: | Fri, 25 Jul 2008 11:04:26 +1000 |
To: | bug-Perl-Critic [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
It might be good if precedence_of() in Perl::Critic::Utils supported the
filetest operators like -f, so it has an answer for basically anything
ppi parses as PPI::Token::Operator.
use strict;
use warnings;
use Perl::Critic::Utils qw(precedence_of);
print precedence_of('-f')//'undef',"\n";
=> "undef"
(I thought I wanted such a precedence for a policy, but ended up only
caring about binary operators, not unaries. I notice
PPI::Token::Operator is not created for pseudo-operators like "sin" and
"cos". Dunno if precedence_of could answer about them too ... perhaps
not.)