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       If you create a module that exports "autodie" you can tell this policy
31       about it with the "autodie_modules" setting:
32
33           [InputOutput::RequireCheckedSyscalls]
34           autodie_modules = My::Thing
35

AUTHOR

37       Andrew Moore <amoore@mooresystems.com>
38

ACKNOWLEDGMENTS

40       This policy module is based heavily on policies written by Jeffrey Ryan
41       Thalhammer <jeff@imaginative-software.com>.
42
44       Copyright (c) 2007-2011 Andrew Moore.  All rights reserved.
45
46       This program is free software; you can redistribute it and/or modify it
47       under the same terms as Perl itself.  The full text of this license can
48       be found in the LICENSE file included with this module.
49
50
51
52perl v5.32.0          Perl::Critic2:0:2P0o-l0i7c-y2:8:InputOutput::RequireCheckedOpen(3)
Impressum