On May 23, 2008, at 8:25 AM, EDAVIS via RT wrote:
Show quoted text>
> Queue: Perl-Critic
> Ticket <URL:
http://rt.cpan.org/Ticket/Display.html?id=36123 >
>
>>> File handle for "print" is not braced at line 7, column 1.
>
>> I don't think this is reasonably fixable.
>
> One heuristic is that while
>
> print UPPERCASE_BAREWORD 1, 2, 3;
>
> is likely to be a bareword filehandle,
>
> print lowercase_bareword 1, 2, 3;
>
> is likely to be a function call. And of course
>
> print $scalar_variable 1, 2, 3;
>
> must be a filehandle.
That logic makes sense, but personally I don't like it. I consider
myself a Perl expert, but even I can't remember when I look at some
code what conditions print() considers its first arg a filehandle or
not. I prefer the P::C approach that barewords as the first arg to
print() is always wrong -- either should you wrap it in curlies or
you should use parens on the function call. The key point, I
believe, is to make it easier for a *human* to interpret the
intention of the code -- in that case, the above doesn't help unless
the human already knows the rule.
Chris