1bareword::filehandles(3U)ser Contributed Perl Documentatiboanreword::filehandles(3)
2
3
4
6 bareword::filehandles - disables bareword filehandles
7
9 version 0.007
10
12 no bareword::filehandles;
13
14 open FH, $file # dies
15 open my $fh, $file; # doesn't die
16
17 print FH $string # dies
18 print STDERR $string # doesn't die
19
21 This module lexically disables the use of bareword filehandles with
22 builtin functions, except for the special builtin filehandles "STDIN",
23 "STDOUT", "STDERR", "ARGV", "ARGVOUT" and "DATA".
24
26 unimport
27 Disables bareword filehandles for the remainder of the scope being
28 compiled.
29
30 import
31 Enables bareword filehandles for the remainder of the scope being
32 compiled.
33
35 Filetest operators ("-X") can not be checked on Perl versions before
36 5.32, because hooking the op check function for these breaks stacked
37 tests, e.g. "-f -w -x $file".
38
40 perlfunc, B::Hooks::OP::Check.
41
43 Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
44
46 This software is copyright (c) 2011 - 2016 by Dagfinn Ilmari Mannsåker.
47
48 This is free software; you can redistribute it and/or modify it under
49 the same terms as the Perl 5 programming language system itself.
50
51
52
53perl v5.34.0 2022-01-20 bareword::filehandles(3)