On Jul 17, 2006, at 5:38 PM, Joe McMahon via RT wrote:
Show quoted text> The construction
>
> while(defined( $_ = $self->next_line )) {
>
> is flagged as "Builtin function called with parens at..." which is
> incorrect. If the parentheses are removed, the expression is
> interpreted as
>
> while ( (defined $_) = $self->next_line)) {
>
> which is wrong; you'll get "Can't modify defined operator in scalar
> assignment at...".
>
> Similar constructions - defined( $_ = <>), etc. - are also flagged.
Hi Joe!
Hmm, that's a problem that I thought was solved as of v0.14. Jeff
changed the behavior so the unary functions, like "defined", look
ahead to see if there are high-precedence operatorors inside the
parens, and remain silent if so.
I can't seem reproduce your problem immediately. The following does
not trigger the warning:
echo 'while(defined( $_ = $self->next_line )) {}' | perl -Ilib bin/
perlcritic -include Paren
while the following (changed "=" to "=>") does trigger it
echo 'while(defined( $_ => $self->next_line )) {}' | perl -Ilib
bin/perlcritic -include Paren
Could you please report your PPI.pm version? I'm currently using the
SVN head version of PPI which has some bug fixes not yet available on
CPAN...
Chris
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703
vCard:
http://www.chrisdolan.net/ChrisDolan.vcf
Clotho Advanced Media, Inc. - Creators of MediaLandscape Software
(
http://www.media-landscape.com/) and partners in the revolutionary
Croquet project (
http://www.opencroquet.org/)