Filename | /usr/lib/perl5/5.20.1/warnings/register.pm |
Statements | Executed 13 statements in 14µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
2 | 2 | 2 | 12µs | 99µ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 | 300ns | our $VERSION = '1.03'; | ||
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> for more information on this module's usage. | ||||
20 | |||||
21 | =cut | ||||
22 | |||||
23 | 1 | 100ns | require warnings; | ||
24 | |||||
25 | # left here as cruft in case other users were using this undocumented routine | ||||
26 | # -- rjbs, 2010-09-08 | ||||
27 | sub mkMask | ||||
28 | { | ||||
29 | my ($bit) = @_; | ||||
30 | my $mask = ""; | ||||
31 | |||||
32 | vec($mask, $bit, 1) = 1; | ||||
33 | return $mask; | ||||
34 | } | ||||
35 | |||||
36 | sub import | ||||
37 | # spent 99µs (12+87) within warnings::register::import which was called 2 times, avg 50µs/call:
# once (7µs+46µs) by constant::BEGIN@4 at line 4 of constant.pm
# once (5µs+41µs) by vars::BEGIN@7 at line 7 of vars.pm | ||||
38 | 2 | 200ns | shift; | ||
39 | 2 | 900ns | my @categories = @_; | ||
40 | |||||
41 | 2 | 4µs | my $package = (caller(0))[0]; | ||
42 | 2 | 2µs | 2 | 87µs | warnings::register_categories($package); # spent 87µs making 2 calls to warnings::register_categories, avg 44µs/call |
43 | |||||
44 | 2 | 4µs | warnings::register_categories($package . "::$_") for @categories; | ||
45 | } | ||||
46 | |||||
47 | 1 | 2µs | 1; |