[sf-perl] Related to Perl Best Practices / a Perl::Critic Rule
brian.friday at gmail.com
Thu Feb 25 07:34:49 PST 2010
There is one specific Perl::Critic rule that confounds me and I am wondering if anyone can shed any light into the why of it.
You have a Perl program with:
Run it through Perl::Critic and you get the following error:
Return value of flagged function ignored - print at line 27, column 1. See pages 208,278 of PBP. (Severity: 1)
Change the line to:
print "Something\n" or croak "blah\n";
Perl::Critic no longer has any issues with the code, life continues on.
If the print had a $var call in it, this croak does not stop you from printing on uninitialized values. I have been mulling it over but for print itself I have not been able to find a definitive "this is a good idea because...." .
I treat the PBP and Perl::Critic as a guide to good Perl coding behavior and not a book of rules. That said I like to understand a rule before I throw it out. This rule just happens to be one I come back to because no answer I have come up with pushes me over the use it side or lose it side of the fence.
More information about the SanFrancisco-pm