Change 17885 by rgs@rgs-home on 2002/09/09 20:35:34 Subject: [PATCH] strict.pm pod at __END__ From: Nicholas Clark <[EMAIL PROTECTED]> Date: Sun, 8 Sep 2002 22:36:09 +0100 Message-ID: <[EMAIL PROTECTED]>
Affected files ... .... //depot/perl/lib/strict.pm#16 edit Differences ... ==== //depot/perl/lib/strict.pm#16 (text) ==== Index: perl/lib/strict.pm --- perl/lib/strict.pm#15~17869~ Sun Sep 8 08:46:08 2002 +++ perl/lib/strict.pm Mon Sep 9 13:35:34 2002 @@ -1,5 +1,44 @@ package strict; +$strict::VERSION = "1.02"; + +my %bitmask = ( +refs => 0x00000002, +subs => 0x00000200, +vars => 0x00000400 +); + +sub bits { + my $bits = 0; + my @wrong; + foreach my $s (@_) { + push @wrong, $s unless exists $bitmask{$s}; + $bits |= $bitmask{$s} || 0; + } + if (@wrong) { + my $useno = { + __PACKAGE__.'::import' => 'use', + __PACKAGE__.'::unimport' => 'no' + }->{ (caller(1))[3] }; + require Carp; + Carp::croak("Don't know how to '$useno ".__PACKAGE__." qw(@wrong)'"); + } + $bits; +} + +sub import { + shift; + $^H |= bits(@_ ? @_ : qw(refs subs vars)); +} + +sub unimport { + shift; + $^H &= ~ bits(@_ ? @_ : qw(refs subs vars)); +} + +1; +__END__ + =head1 NAME strict - Perl pragma to restrict unsafe constructs @@ -87,43 +126,4 @@ See L<perlmodlib/Pragmatic Modules>. - =cut - -$strict::VERSION = "1.02"; - -my %bitmask = ( -refs => 0x00000002, -subs => 0x00000200, -vars => 0x00000400 -); - -sub bits { - my $bits = 0; - my @wrong; - foreach my $s (@_) { - push @wrong, $s unless exists $bitmask{$s}; - $bits |= $bitmask{$s} || 0; - } - if (@wrong) { - my $useno = { - __PACKAGE__.'::import' => 'use', - __PACKAGE__.'::unimport' => 'no' - }->{ (caller(1))[3] }; - require Carp; - Carp::croak("Don't know how to '$useno ".__PACKAGE__." qw(@wrong)'"); - } - $bits; -} - -sub import { - shift; - $^H |= bits(@_ ? @_ : qw(refs subs vars)); -} - -sub unimport { - shift; - $^H &= ~ bits(@_ ? @_ : qw(refs subs vars)); -} - -1; End of Patch.