Filename | /usr/local/lib/perl/5.18.2/Sub/Name.pm |
Statements | Executed 16 statements in 473µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 2 | 1 | 40µs | 40µs | subname (xsub) | Sub::Name::
1 | 1 | 1 | 24µs | 33µs | BEGIN@54 | Sub::Name::
1 | 1 | 1 | 19µs | 19µs | BEGIN@51 | Sub::Name::
1 | 1 | 1 | 16µs | 35µs | BEGIN@58 | Sub::Name::
1 | 1 | 1 | 10µs | 45µs | BEGIN@53 | Sub::Name::
1 | 1 | 1 | 6µs | 6µs | BEGIN@63 | Sub::Name::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Sub::Name; # git description: v0.13-7-g79187d2 | ||||
2 | # ABSTRACT: (re)name a sub | ||||
3 | |||||
4 | #pod =pod | ||||
5 | #pod | ||||
6 | #pod =head1 SYNOPSIS | ||||
7 | #pod | ||||
8 | #pod use Sub::Name; | ||||
9 | #pod | ||||
10 | #pod subname $name, $subref; | ||||
11 | #pod | ||||
12 | #pod $subref = subname foo => sub { ... }; | ||||
13 | #pod | ||||
14 | #pod =head1 DESCRIPTION | ||||
15 | #pod | ||||
16 | #pod This module has only one function, which is also exported by default: | ||||
17 | #pod | ||||
18 | #pod =for stopwords subname | ||||
19 | #pod | ||||
20 | #pod =head2 subname NAME, CODEREF | ||||
21 | #pod | ||||
22 | #pod Assigns a new name to referenced sub. If package specification is omitted in | ||||
23 | #pod the name, then the current package is used. The return value is the sub. | ||||
24 | #pod | ||||
25 | #pod The name is only used for informative routines (caller, Carp, etc). You won't | ||||
26 | #pod be able to actually invoke the sub by the given name. To allow that, you need | ||||
27 | #pod to do glob-assignment yourself. | ||||
28 | #pod | ||||
29 | #pod Note that for anonymous closures (subs that reference lexicals declared outside | ||||
30 | #pod the sub itself) you can name each instance of the closure differently, which | ||||
31 | #pod can be very useful for debugging. | ||||
32 | #pod | ||||
33 | #pod =head1 SEE ALSO | ||||
34 | #pod | ||||
35 | #pod =for :list | ||||
36 | #pod * L<Sub::Identify> - for getting information about subs | ||||
37 | #pod * L<Sub::Util> - set_subname is another implementation of C<subname> | ||||
38 | #pod | ||||
39 | #pod =for stopwords cPanel | ||||
40 | #pod | ||||
41 | #pod =head1 COPYRIGHT AND LICENSE | ||||
42 | #pod | ||||
43 | #pod This software is copyright (c) 2004, 2008 by Matthijs van Duin, all rights reserved; | ||||
44 | #pod copyright (c) 2014 cPanel Inc., all rights reserved. | ||||
45 | #pod | ||||
46 | #pod This program is free software; you can redistribute it and/or modify | ||||
47 | #pod it under the same terms as Perl itself. | ||||
48 | #pod | ||||
49 | #pod =cut | ||||
50 | |||||
51 | 2 | 58µs | 1 | 19µs | # spent 19µs within Sub::Name::BEGIN@51 which was called:
# once (19µs+0s) by Try::Tiny::BEGIN@1 at line 51 # spent 19µs making 1 call to Sub::Name::BEGIN@51 |
52 | |||||
53 | 2 | 46µs | 2 | 80µs | # spent 45µs (10+35) within Sub::Name::BEGIN@53 which was called:
# once (10µs+35µs) by Try::Tiny::BEGIN@1 at line 53 # spent 45µs making 1 call to Sub::Name::BEGIN@53
# spent 35µs making 1 call to strict::import |
54 | 2 | 64µs | 2 | 42µs | # spent 33µs (24+9) within Sub::Name::BEGIN@54 which was called:
# once (24µs+9µs) by Try::Tiny::BEGIN@1 at line 54 # spent 33µs making 1 call to Sub::Name::BEGIN@54
# spent 9µs making 1 call to warnings::import |
55 | |||||
56 | 1 | 700ns | our $VERSION = '0.14'; | ||
57 | |||||
58 | 3 | 83µs | 3 | 54µs | # spent 35µs (16+19) within Sub::Name::BEGIN@58 which was called:
# once (16µs+19µs) by Try::Tiny::BEGIN@1 at line 58 # spent 35µs making 1 call to Sub::Name::BEGIN@58
# spent 11µs making 1 call to UNIVERSAL::VERSION
# spent 8µs making 1 call to Exporter::import |
59 | |||||
60 | 1 | 1µs | our @EXPORT = qw(subname); | ||
61 | 1 | 600ns | our @EXPORT_OK = @EXPORT; | ||
62 | |||||
63 | 2 | 49µs | 1 | 6µs | # spent 6µs within Sub::Name::BEGIN@63 which was called:
# once (6µs+0s) by Try::Tiny::BEGIN@1 at line 63 # spent 6µs making 1 call to Sub::Name::BEGIN@63 |
64 | 1 | 164µs | 1 | 156µs | XSLoader::load( # spent 156µs making 1 call to XSLoader::load |
65 | __PACKAGE__, | ||||
66 | $VERSION, | ||||
67 | ); | ||||
68 | |||||
69 | 1 | 6µs | 1; | ||
70 | |||||
71 | __END__ | ||||
# spent 40µs within Sub::Name::subname which was called 4 times, avg 10µs/call:
# 2 times (25µs+0s) by Try::Tiny::try at line 60 of Try/Tiny.pm, avg 12µs/call
# 2 times (16µs+0s) by Try::Tiny::try at line 61 of Try/Tiny.pm, avg 8µs/call |