5 strict - Perl pragma to restrict unsafe constructs
20 If no import list is supplied, all possible restrictions are assumed.
21 (This is the safest mode to operate in, but is sometimes too strict for
22 casual programming.) Currently, there are three possible things to be
23 strict about: "subs", "vars", and "refs".
29 This generates a runtime error if you
30 use symbolic references (see L<perlref>).
36 print $$ref; # runtime error; normally ok
40 This generates a compile-time error if you access a variable that wasn't
41 declared via C<use vars>,
42 localized via C<my()> or wasn't fully qualified. Because this is to avoid
43 variable suicide problems and subtle dynamic scoping issues, a merely
44 local() variable isn't good enough. See L<perlfunc/my> and
48 $X::foo = 1; # ok, fully qualified
49 my $foo = 10; # ok, my() var
50 local $foo = 9; # blows up
53 use vars qw/ $bar /; # Declares $bar in current package
54 $bar = 'HgS'; # ok, global declared via pragma
56 The local() generated a compile-time error because you just touched a global
57 name without fully qualifying it.
61 This disables the poetry optimization, generating a compile-time error if
62 you try to use a bareword identifier that's not a subroutine, unless it
63 appears in curly braces or on the left hand side of the "=E<gt>" symbol.
67 $SIG{PIPE} = Plumber; # blows up
68 $SIG{PIPE} = "Plumber"; # just fine: bareword in curlies always ok
69 $SIG{PIPE} = \&Plumber; # preferred form
75 See L<perlmodlib/Pragmatic Modules>.
80 $strict::VERSION = "1.01";
90 foreach my $s (@_){ $bits |= $bitmask{$s} || 0; };
96 $^H |= bits(@_ ? @_ : qw(refs subs vars));
101 $^H &= ~ bits(@_ ? @_ : qw(refs subs vars));