Filename | /usr/local/lib/perl5/5.32/strict.pm |
Statements | Executed 2 statements in 10µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 15µs | 15µs | import | strict::
0 | 0 | 0 | 0s | 0s | BEGIN@7 | strict::
0 | 0 | 0 | 0s | 0s | CORE:match (opcode) | strict::
0 | 0 | 0 | 0s | 0s | __ANON__[:31] | strict::
0 | 0 | 0 | 0s | 0s | __ANON__[:37] | strict::
0 | 0 | 0 | 0s | 0s | bits | strict::
0 | 0 | 0 | 0s | 0s | unimport | strict::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strict; | ||||
2 | |||||
3 | $strict::VERSION = "1.11"; | ||||
4 | |||||
5 | my ( %bitmask, %explicit_bitmask ); | ||||
6 | |||||
7 | BEGIN { | ||||
8 | # Verify that we're called correctly so that strictures will work. | ||||
9 | # Can't use Carp, since Carp uses us! | ||||
10 | # see also warnings.pm. | ||||
11 | die sprintf "Incorrect use of pragma '%s' at %s line %d.\n", __PACKAGE__, +(caller)[1,2] | ||||
12 | if __FILE__ !~ ( '(?x) \b '.__PACKAGE__.' \.pmc? \z' ) | ||||
13 | && __FILE__ =~ ( '(?x) \b (?i:'.__PACKAGE__.') \.pmc? \z' ); | ||||
14 | |||||
15 | %bitmask = ( | ||||
16 | refs => 0x00000002, | ||||
17 | subs => 0x00000200, | ||||
18 | vars => 0x00000400, | ||||
19 | ); | ||||
20 | |||||
21 | %explicit_bitmask = ( | ||||
22 | refs => 0x00000020, | ||||
23 | subs => 0x00000040, | ||||
24 | vars => 0x00000080, | ||||
25 | ); | ||||
26 | |||||
27 | my $bits = 0; | ||||
28 | $bits |= $_ for values %bitmask; | ||||
29 | |||||
30 | my $inline_all_bits = $bits; | ||||
31 | *all_bits = sub () { $inline_all_bits }; | ||||
32 | |||||
33 | $bits = 0; | ||||
34 | $bits |= $_ for values %explicit_bitmask; | ||||
35 | |||||
36 | my $inline_all_explicit_bits = $bits; | ||||
37 | *all_explicit_bits = sub () { $inline_all_explicit_bits }; | ||||
38 | } | ||||
39 | |||||
40 | sub bits { | ||||
41 | my $bits = 0; | ||||
42 | my @wrong; | ||||
43 | foreach my $s (@_) { | ||||
44 | if (exists $bitmask{$s}) { | ||||
45 | $^H |= $explicit_bitmask{$s}; | ||||
46 | |||||
47 | $bits |= $bitmask{$s}; | ||||
48 | } | ||||
49 | else { | ||||
50 | push @wrong, $s; | ||||
51 | } | ||||
52 | } | ||||
53 | if (@wrong) { | ||||
54 | require Carp; | ||||
55 | Carp::croak("Unknown 'strict' tag(s) '@wrong'"); | ||||
56 | } | ||||
57 | $bits; | ||||
58 | } | ||||
59 | |||||
60 | # spent 15µs within strict::import which was called:
# once (15µs+0s) by Sympa::Spool::Task::BEGIN@26 at line 26 of /usr/local/libexec/sympa/Sympa/Spool/Task.pm | ||||
61 | 1 | 1µs | shift; | ||
62 | 1 | 8µs | $^H |= @_ ? &bits : all_bits | all_explicit_bits; | ||
63 | } | ||||
64 | |||||
65 | sub unimport { | ||||
66 | shift; | ||||
67 | |||||
68 | if (@_) { | ||||
69 | $^H &= ~&bits; | ||||
70 | } | ||||
71 | else { | ||||
72 | $^H &= ~all_bits; | ||||
73 | $^H |= all_explicit_bits; | ||||
74 | } | ||||
75 | } | ||||
76 | |||||
77 | 1; | ||||
78 | __END__ |