Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perl::critic::policy::inputoutput::requirecheckedsyscalls(3) [centos man page]

Perl::Critic::Policy::InputOutput::RequireCheckedSyscallUser Contributed Perl DocumentPerl::Critic::Policy::InputOutput::RequireCheckedSyscalls(3)

NAME
Perl::Critic::Policy::InputOutput::RequireCheckedSyscalls - Return value of flagged function ignored. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
This performs identically to InputOutput::RequireCheckedOpen/Close except that this is configurable to apply to any function, whether core or user-defined. If your module uses Fatal, Fatal::Exception, or autodie then any functions wrapped by those modules will not trigger this policy. For example: use Fatal qw(open); open my $fh, $filename; # no violation close $fh; # yes violation use autodie; open $filehandle, $mode, $filename; # no violation Currently, autodie is not properly treated as a pragma; its lexical effects aren't taken into account. CONFIGURATION
This policy watches for a configurable list of function names. By default, it applies to "open", "print", "say" and "close". You can override this to set it to a different list of functions with the "functions" and "exclude_functions" settings. To do this, put entries in a .perlcriticrc file like this: [InputOutput::RequireCheckedSyscalls] functions = open opendir read readline readdir close closedir We have defined a few shortcuts for creating this list [InputOutput::RequireCheckedSyscalls] functions = :defaults opendir readdir closedir [InputOutput::RequireCheckedSyscalls] functions = :builtins [InputOutput::RequireCheckedSyscalls] functions = :all The ":builtins" shortcut above represents all of the builtin functions that have error conditions (about 65 of them, many of them rather obscure). You can require checking all builtins except "print" by combining the "functions" and "exclude_functions": [InputOutput::RequireCheckedSyscalls] functions = :builtins exclude_functions = print This is a lot easier to read than the alternative. The ":all" is the insane case: you must check the return value of EVERY function call, even "return" and "exit". Yes, this "feature" is overkill and is wasting CPU cycles on your computer by just existing. Nyah nyah. I shouldn't code after midnight. CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation. This policy module is based heavily on policies written by Andrew Moore <amoore@mooresystems.com>. AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many 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::RequireCheckedSyscalls(3)

Check Out this Related Man Page

Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen(3pUser Contributed Perl DocumentatPerl::Critic::Policy::InputOutput::ProhibitTwoArgOpen(3pm)

NAME
Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen - Write "open $fh, q{<}, $filename;" instead of "open $fh, "<$filename";". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
The three-argument form of "open" (introduced in Perl 5.6) prevents subtle bugs that occur when the filename starts with funny characters like '>' or '<'. The IO::File module provides a nice object-oriented interface to filehandles, which I think is more elegant anyway. open( $fh, '>output.txt' ); # not ok open( $fh, q{>}, 'output.txt' ); # ok use IO::File; my $fh = IO::File->new( 'output.txt', q{>} ); # even better! It's also more explicitly clear to define the input mode of the file, as in the difference between these two: open( $fh, 'foo.txt' ); # BAD: Reader must think what default mode is open( $fh, '<', 'foo.txt' ); # GOOD: Reader can see open mode This policy will not complain if the file explicitly states that it is compatible with a version of perl prior to 5.6 via an include statement, e.g. by having "require 5.005" in it. CONFIGURATION
This Policy is not configurable except for the standard options. NOTES
There are two cases in which you are forced to use the two-argument form of open. When re-opening STDIN, STDOUT, or STDERR, and when doing a safe pipe open, as described in perlipc. SEE ALSO
IO::Handle IO::File 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. perl v5.14.2 2012-06-07 Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen(3pm)
Man Page