Filename | /usr/lib64/perl5/5.16.0/subs.pm |
Statements | Executed 8 statements in 188µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 96µs | 96µs | import | subs::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package subs; | ||||
2 | |||||
3 | 1 | 4µs | our $VERSION = '1.01'; | ||
4 | |||||
5 | =head1 NAME | ||||
6 | |||||
7 | subs - Perl pragma to predeclare sub names | ||||
8 | |||||
9 | =head1 SYNOPSIS | ||||
10 | |||||
11 | use subs qw(frob); | ||||
12 | frob 3..10; | ||||
13 | |||||
14 | =head1 DESCRIPTION | ||||
15 | |||||
16 | This will predeclare all the subroutine whose names are | ||||
17 | in the list, allowing you to use them without parentheses | ||||
18 | even before they're declared. | ||||
19 | |||||
20 | Unlike pragmas that affect the C<$^H> hints variable, the C<use vars> and | ||||
21 | C<use subs> declarations are not BLOCK-scoped. They are thus effective | ||||
22 | for the entire package in which they appear. You may not rescind such | ||||
23 | declarations with C<no vars> or C<no subs>. | ||||
24 | |||||
25 | See L<perlmodlib/Pragmatic Modules> and L<strict/strict subs>. | ||||
26 | |||||
27 | =cut | ||||
28 | |||||
29 | 1 | 56µs | require 5.000; | ||
30 | |||||
31 | # spent 96µs within subs::import which was called:
# once (96µs+0s) by Data::Dump::PHP::BEGIN@7 at line 7 of Data/Dump/PHP.pm | ||||
32 | 1 | 6µs | my $callpack = caller; | ||
33 | 1 | 3µs | my $pack = shift; | ||
34 | 1 | 7µs | my @imports = @_; | ||
35 | 1 | 38µs | foreach $sym (@imports) { | ||
36 | 1 | 60µs | *{"${callpack}::$sym"} = \&{"${callpack}::$sym"}; | ||
37 | } | ||||
38 | }; | ||||
39 | |||||
40 | 1 | 14µs | 1; |