Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/5.18.0/warnings/register.pm |
Statements | Executed 18 statements in 23µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
3 | 3 | 3 | 19µs | 189µs | import | warnings::register::
0 | 0 | 0 | 0s | 0s | mkMask | warnings::register::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package warnings::register; | ||||
2 | |||||
3 | 1 | 400ns | our $VERSION = '1.02'; | ||
4 | |||||
5 | =pod | ||||
6 | |||||
7 | =head1 NAME | ||||
8 | |||||
9 | warnings::register - warnings import function | ||||
10 | |||||
11 | =head1 SYNOPSIS | ||||
12 | |||||
13 | use warnings::register; | ||||
14 | |||||
15 | =head1 DESCRIPTION | ||||
16 | |||||
17 | Creates a warnings category with the same name as the current package. | ||||
18 | |||||
19 | See L<warnings> and L<perllexwarn> for more information on this module's | ||||
20 | usage. | ||||
21 | |||||
22 | =cut | ||||
23 | |||||
24 | 1 | 200ns | require warnings; | ||
25 | |||||
26 | # left here as cruft in case other users were using this undocumented routine | ||||
27 | # -- rjbs, 2010-09-08 | ||||
28 | sub mkMask | ||||
29 | { | ||||
30 | my ($bit) = @_; | ||||
31 | my $mask = ""; | ||||
32 | |||||
33 | vec($mask, $bit, 1) = 1; | ||||
34 | return $mask; | ||||
35 | } | ||||
36 | |||||
37 | sub import | ||||
38 | # spent 189µs (19+169) within warnings::register::import which was called 3 times, avg 63µs/call:
# once (8µs+58µs) by vars::BEGIN@7 at line 7 of vars.pm
# once (6µs+56µs) by constant::BEGIN@4 at line 4 of constant.pm
# once (6µs+55µs) by overload::BEGIN@144 at line 144 of overload.pm | ||||
39 | 3 | 300ns | shift; | ||
40 | 3 | 1µs | my @categories = @_; | ||
41 | |||||
42 | 3 | 6µs | my $package = (caller(0))[0]; | ||
43 | 3 | 3µs | 3 | 169µs | warnings::register_categories($package); # spent 169µs making 3 calls to warnings::register_categories, avg 56µs/call |
44 | |||||
45 | 3 | 9µs | warnings::register_categories($package . "::$_") for @categories; | ||
46 | } | ||||
47 | |||||
48 | 1 | 2µs | 1; |