| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Sub/Name.pm |
| Statements | Executed 16 statements in 249µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1057 | 6 | 5 | 3.03ms | 3.03ms | Sub::Name::subname (xsub) |
| 1 | 1 | 1 | 14µs | 14µs | Sub::Name::BEGIN@51 |
| 1 | 1 | 1 | 8µs | 18µs | Sub::Name::BEGIN@58 |
| 1 | 1 | 1 | 6µs | 8µs | Sub::Name::BEGIN@53 |
| 1 | 1 | 1 | 5µs | 11µs | Sub::Name::BEGIN@54 |
| 1 | 1 | 1 | 3µs | 3µs | Sub::Name::BEGIN@63 |
| 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 | 32µs | 1 | 14µs | # spent 14µs within Sub::Name::BEGIN@51 which was called:
# once (14µs+0s) by Class::MOP::Mixin::HasMethods::BEGIN@10 at line 51 # spent 14µs making 1 call to Sub::Name::BEGIN@51 |
| 52 | |||||
| 53 | 2 | 16µs | 2 | 10µs | # spent 8µs (6+2) within Sub::Name::BEGIN@53 which was called:
# once (6µs+2µs) by Class::MOP::Mixin::HasMethods::BEGIN@10 at line 53 # spent 8µs making 1 call to Sub::Name::BEGIN@53
# spent 2µs making 1 call to strict::import |
| 54 | 2 | 25µs | 2 | 17µs | # spent 11µs (5+6) within Sub::Name::BEGIN@54 which was called:
# once (5µs+6µs) by Class::MOP::Mixin::HasMethods::BEGIN@10 at line 54 # spent 11µs making 1 call to Sub::Name::BEGIN@54
# spent 6µs making 1 call to warnings::import |
| 55 | |||||
| 56 | 1 | 200ns | our $VERSION = '0.14'; | ||
| 57 | |||||
| 58 | 3 | 35µs | 3 | 27µs | # spent 18µs (8+9) within Sub::Name::BEGIN@58 which was called:
# once (8µs+9µs) by Class::MOP::Mixin::HasMethods::BEGIN@10 at line 58 # spent 18µs making 1 call to Sub::Name::BEGIN@58
# spent 5µs making 1 call to Exporter::import
# spent 5µs making 1 call to UNIVERSAL::VERSION |
| 59 | |||||
| 60 | 1 | 600ns | our @EXPORT = qw(subname); | ||
| 61 | 1 | 300ns | our @EXPORT_OK = @EXPORT; | ||
| 62 | |||||
| 63 | 2 | 23µs | 1 | 3µs | # spent 3µs within Sub::Name::BEGIN@63 which was called:
# once (3µs+0s) by Class::MOP::Mixin::HasMethods::BEGIN@10 at line 63 # spent 3µs making 1 call to Sub::Name::BEGIN@63 |
| 64 | 1 | 114µs | 1 | 110µs | XSLoader::load( # spent 110µs making 1 call to XSLoader::load |
| 65 | __PACKAGE__, | ||||
| 66 | $VERSION, | ||||
| 67 | ); | ||||
| 68 | |||||
| 69 | 1 | 3µs | 1; | ||
| 70 | |||||
| 71 | __END__ | ||||
# spent 3.03ms within Sub::Name::subname which was called 1057 times, avg 3µs/call:
# 673 times (1.66ms+0s) by Class::MOP::Class::Immutable::Class::MOP::Class::_method_map or Class::MOP::Class::Immutable::Class::MOP::Class::get_all_attributes or Class::MOP::Class::Immutable::Class::MOP::Class::get_meta_instance or Class::MOP::Class::Immutable::Class::MOP::Class::is_immutable or Class::MOP::Class::Immutable::Class::MOP::Class::linearized_isa at line 94 of Class/MOP/Method/Wrapped.pm, avg 2µs/call
# 319 times (1.22ms+0s) by Class::MOP::Mixin::HasMethods::add_method at line 75 of Class/MOP/Mixin/HasMethods.pm, avg 4µs/call
# 43 times (90µs+0s) by Class::MOP::Class::add_around_method_modifier at line 1109 of Class/MOP/Class.pm, avg 2µs/call
# 10 times (22µs+0s) by Class::Accessor::_mk_accessors at line 82 of Class/Accessor.pm, avg 2µs/call
# 8 times (18µs+0s) by Moose::Exporter::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Exporter.pm:389] at line 384 of Moose/Exporter.pm, avg 2µs/call
# 4 times (15µs+0s) by Moose::Exporter::build_import_methods at line 94 of Moose/Exporter.pm, avg 4µs/call |