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