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: 56618
Status: rejected
Priority: 0/
Queue: Perl-Critic

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

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Return value of flagged function ignored - print (possibly false positive)
Return value of flagged function ignored - print at line 6, column 5. See pages 208,278 of PBP. 1 #!/usr/bin/perl 2 use strict; 3 4 sub Test () 5 { 6 print "test"; 7 }
Subject: Re: [rt.cpan.org #56618] Return value of flagged function ignored - print (possibly false positive)
Date: Thu, 15 Apr 2010 07:58:45 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 4/15/10 3:48 AM, Jari Aalto via RT wrote: Show quoted text
> Return value of flagged function ignored - print at line 6, column 5. > See pages 208,278 of PBP. > > 1 #!/usr/bin/perl > 2 use strict; > 3 > 4 sub Test () > 5 { > 6 print "test"; > 7 }
That's a true positive: you aren't checking the return value of print.
On Thu Apr 15 08:59:00 2010, clonezone wrote: Show quoted text
> On 4/15/10 3:48 AM, Jari Aalto via RT wrote:
> > Return value of flagged function ignored - print at line 6, column
5. Show quoted text
> > See pages 208,278 of PBP. > > > > 1 #!/usr/bin/perl > > 2 use strict; > > 3 > > 4 sub Test () > > 5 { > > 6 print "test"; > > 7 }
> > That's a true positive: you aren't checking the return value of print.
That would be like slamming with a 10 tonnage hammer. print() and printf() not customarily checked when output is sent to STDOUT or STDERR. If you happen to have a production code to show where every print-call is surrounded by error checks, then we're all believers. The only place this could be potentially useful is from PHP. Please add more fine grained control how to list functions that are exempt from this check. The current configuration InputOutput::RequireCheckedSyscalls is "all or nothing", which isn't helpful.
Subject: Re: [rt.cpan.org #56618] Return value of flagged function ignored - print (possibly false positive)
Date: Wed, 21 Apr 2010 20:31:40 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 4/15/10 8:45 AM, Jari Aalto via RT wrote: Show quoted text
> print() and printf() not customarily checked when output is sent to > STDOUT or STDERR. If you happen to have a production code to show where > every print-call is surrounded by error checks, then we're all > believers. The only place this could be potentially useful is from PHP.
The defaults of this policy are specifically to look for open, close, print, and say, i.e. the specific intent is for you to check for the result of those builtins. Show quoted text
> Please add more fine grained control how to list functions that are > exempt from this check. The current configuration > > InputOutput::RequireCheckedSyscalls > > > is "all or nothing", which isn't helpful.
This policy is configurable; it is not "all or nothing". You could cause the policy to complain about all error-reporting builtins except print like this: [InputOutput::RequireCheckedSyscalls] functions = :builtins exclude_functions = print