File Coverage

inc/strict.pm
Criterion Covered Total %
statement 0 13 0.0
branch 0 8 0.0
condition 0 2 0.0
subroutine 0 3 0.0
pod 0 1 0.0
total 0 27 0.0


line stmt bran cond sub pod time code
1             #line 1
2             package strict;
3              
4             $strict::VERSION = "1.04";
5              
6             # Verify that we're called correctly so that strictures will work.
7             unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
8             # Can't use Carp, since Carp uses us!
9             my (undef, $f, $l) = caller;
10             die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
11             }
12              
13             my %bitmask = (
14             refs => 0x00000002,
15             subs => 0x00000200,
16             vars => 0x00000400
17             );
18              
19 0     0 0   sub bits {
20 0           my $bits = 0;
21 0           my @wrong;
22 0 0         foreach my $s (@_) {
23 0   0       push @wrong, $s unless exists $bitmask{$s};
24             $bits |= $bitmask{$s} || 0;
25 0 0         }
26 0           if (@wrong) {
27 0           require Carp;
28             Carp::croak("Unknown 'strict' tag(s) '@wrong'");
29 0           }
30             $bits;
31             }
32              
33             my $default_bits = bits(qw(refs subs vars));
34              
35 0     0     sub import {
36 0 0         shift;
37             $^H |= @_ ? bits(@_) : $default_bits;
38             }
39              
40 0     0     sub unimport {
41 0 0         shift;
42             $^H &= ~ (@_ ? bits(@_) : $default_bits);
43             }
44              
45             1;
46             __END__