Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 20522
Status: rejected
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: mcmahon [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.18
Fixed in: (no value)



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.
Subject: Re: [rt.cpan.org #20522]
Date: Mon, 17 Jul 2006 17:55:20 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Chris Dolan <chris [...] clotho.com>
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/)
I can't reproduce this either, so I'm marking it as "rejected" for now.