1Perl::Critic::Policy::IUPnseperurlt:OC:uoCtnrptiurttii:bc:u:Rt:eePqdouliPireceryCl:h:eDIconkcpeuudmtOeOpnuettnap(tu3it)o:n:RequireCheckedOpen(3)
2
3
4

NAME

6       Perl::Critic::Policy::InputOutput::RequireCheckedOpen - Write "my
7       $error = open $fh, $mode, $filename;" instead of "open $fh, $mode,
8       $filename;".
9

AFFILIATION

11       This Policy is part of the core Perl::Critic distribution.
12

DESCRIPTION

14       The perl builtin I/O function "open" returns a false value on failure.
15       That value should always be checked to ensure that the open was
16       successful.
17
18           my $error = open( $filehandle, $mode, $filename );                  # ok
19           open( $filehandle, $mode, $filename ) or die "unable to open: $!";  # ok
20           open( $filehandle, $mode, $filename );                              # not ok
21
22           use autodie;
23           open $filehandle, $mode, $filename;                                 # ok
24
25       You can use autodie, Fatal, or Fatal::Exception to get around this.
26       Currently, autodie is not properly treated as a pragma; its lexical
27       effects aren't taken into account.
28

CONFIGURATION

30       This Policy is not configurable except for the standard options.
31

AUTHOR

33       Andrew Moore <amoore@mooresystems.com>
34

ACKNOWLEDGMENTS

36       This policy module is based heavily on policies written by Jeffrey Ryan
37       Thalhammer <thaljef@cpan.org>.
38
40       Copyright (c) 2007-2009 Andrew Moore.  All rights reserved.
41
42       This program is free software; you can redistribute it and/or modify it
43       under the same terms as Perl itself.  The full text of this license can
44       be found in the LICENSE file included with this module.
45
46
47
48perl v5.12.1          Perl::Critic2:0:1P0o-l0i9c-y0:8:InputOutput::RequireCheckedOpen(3)
Impressum