perl::critic::policy::inputoutput::requirecheckedclose(3) [centos man page]
Perl::Critic::Policy::InputOutput::RequireCheckedClose(3User Contributed Perl DocumentatiPerl::Critic::Policy::InputOutput::RequireCheckedClose(3)NAME
Perl::Critic::Policy::InputOutput::RequireCheckedClose - Write "my $error = close $fh;" instead of "close $fh;".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
The perl builtin I/O function "close" returns a false value on failure. That value should be checked to ensure that the close was
successful.
my $error = close $filehandle; # ok
close $filehandle or die "unable to close: $!"; # ok
close $filehandle; # not ok
use autodie qw< :io >;
close $filehandle; # ok
You can use autodie, Fatal, or Fatal::Exception to get around this. Currently, autodie is not properly treated as a pragma; its lexical
effects aren't taken into account.
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Andrew Moore <amoore@mooresystems.com>
ACKNOWLEDGMENTS
This policy module is based heavily on policies written by Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>.
COPYRIGHT
Copyright (c) 2007-2011 Andrew Moore. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 2014-06-09 Perl::Critic::Policy::InputOutput::RequireCheckedClose(3)
Check Out this Related Man Page
Perl::Critic::Policy::InputOutput::ProhibitReadlineInForUser(Contributed Perl DocumPerl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop(3)NAME
Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop - Write "while( $line = <> ){...}" instead of "for(<>){...}".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Using the readline operator in a "for" or "foreach" loop is very slow. The iteration list of the loop creates a list context, which causes
the readline operator to read the entire input stream before iteration even starts. Instead, just use a "while" loop, which only reads one
line at a time.
for my $line ( <$file_handle> ){ do_something($line) } #not ok
while ( my $line = <$file_handle> ){ do_something($line) } #ok
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 2014-06-09 Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop(3)
Man Page
5 More Discussions You Might Find Interesting
1. Forum Support Area for Unregistered Users & Account Problems
I found this logging subroutine on the net that I want to use but despite trying many things, I cannot figure out how to get the date in front of the logged text. Ideally what I'm looking for is a line that looks something like this:
Wed Aug 20 18:17:29 PDT 2008 - my logging info here.
my... (2 Replies)
I have a question regarding Perl scripting.
If I want to say open files that all look like this and assign them to a filehandle and then assign the filehandle to a variable, how do I do this?
The file names are
strand1.fa.gz.tmp
strand2.fa.gz.tmp
strand3.fa.gz.tmp
strand4.fa.gz.tmp
...... (6 Replies)
Discussion started by: japaneseguitars
6 Replies
4. Post Here to Contact Site Administrators and Moderators
Hello,
Why close my ask "How to implement a semaphore with pedestrian pushbutton" i'm autodidact, so i don't understand why you dedice close it.
I put the ask about Java (the language what i'm learning in spanish forum becouse my english is not good) but some body told me that this is the... (1 Reply)
Discussion started by: NewBe
1 Replies
5. Post Here to Contact Site Administrators and Moderators