Filename | /opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Sub/Name.pm |
Statements | Executed 15 statements in 269µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1438 | 7 | 6 | 3.45ms | 3.45ms | subname (xsub) | Sub::Name::
1 | 1 | 1 | 23µs | 23µs | bootstrap (xsub) | Sub::Name::
1 | 1 | 1 | 19µs | 19µs | BEGIN@42 | Sub::Name::
1 | 1 | 1 | 8µs | 13µs | BEGIN@45 | Sub::Name::
1 | 1 | 1 | 8µs | 91µs | BEGIN@49 | Sub::Name::
1 | 1 | 1 | 8µs | 69µs | BEGIN@50 | Sub::Name::
1 | 1 | 1 | 8µs | 24µs | BEGIN@44 | Sub::Name::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Sub::Name; | ||||
2 | |||||
3 | =head1 NAME | ||||
4 | |||||
5 | Sub::Name - (re)name a sub | ||||
6 | |||||
7 | =head1 SYNOPSIS | ||||
8 | |||||
9 | use Sub::Name; | ||||
10 | |||||
11 | subname $name, $subref; | ||||
12 | |||||
13 | $subref = subname foo => sub { ... }; | ||||
14 | |||||
15 | =head1 DESCRIPTION | ||||
16 | |||||
17 | This module has only one function, which is also exported by default: | ||||
18 | |||||
19 | =head2 subname NAME, CODEREF | ||||
20 | |||||
21 | Assigns a new name to referenced sub. If package specification is omitted in | ||||
22 | the name, then the current package is used. The return value is the sub. | ||||
23 | |||||
24 | The name is only used for informative routines (caller, Carp, etc). You won't | ||||
25 | be able to actually invoke the sub by the given name. To allow that, you need | ||||
26 | to do glob-assignment yourself. | ||||
27 | |||||
28 | Note that for anonymous closures (subs that reference lexicals declared outside | ||||
29 | the sub itself) you can name each instance of the closure differently, which | ||||
30 | can be very useful for debugging. | ||||
31 | |||||
32 | =head1 AUTHOR | ||||
33 | |||||
34 | Matthijs van Duin <xmath@cpan.org> | ||||
35 | |||||
36 | Copyright (C) 2004, 2008 Matthijs van Duin. All rights reserved. | ||||
37 | This program is free software; you can redistribute it and/or modify | ||||
38 | it under the same terms as Perl itself. | ||||
39 | |||||
40 | =cut | ||||
41 | |||||
42 | 2 | 67µs | 1 | 19µs | # spent 19µs within Sub::Name::BEGIN@42 which was called:
# once (19µs+0s) by Try::Tiny::BEGIN@1 at line 42 # spent 19µs making 1 call to Sub::Name::BEGIN@42 |
43 | |||||
44 | 2 | 31µs | 2 | 41µs | # spent 24µs (8+16) within Sub::Name::BEGIN@44 which was called:
# once (8µs+16µs) by Try::Tiny::BEGIN@1 at line 44 # spent 24µs making 1 call to Sub::Name::BEGIN@44
# spent 16µs making 1 call to strict::import |
45 | 2 | 43µs | 2 | 18µs | # spent 13µs (8+5) within Sub::Name::BEGIN@45 which was called:
# once (8µs+5µs) by Try::Tiny::BEGIN@1 at line 45 # spent 13µs making 1 call to Sub::Name::BEGIN@45
# spent 5µs making 1 call to warnings::import |
46 | |||||
47 | 1 | 700ns | our $VERSION = '0.05'; | ||
48 | |||||
49 | 2 | 35µs | 2 | 174µs | # spent 91µs (8+83) within Sub::Name::BEGIN@49 which was called:
# once (8µs+83µs) by Try::Tiny::BEGIN@1 at line 49 # spent 91µs making 1 call to Sub::Name::BEGIN@49
# spent 83µs making 1 call to base::import |
50 | 2 | 78µs | 2 | 130µs | # spent 69µs (8+61) within Sub::Name::BEGIN@50 which was called:
# once (8µs+61µs) by Try::Tiny::BEGIN@1 at line 50 # spent 69µs making 1 call to Sub::Name::BEGIN@50
# spent 61µs making 1 call to base::import |
51 | |||||
52 | 1 | 900ns | our @EXPORT = qw(subname); | ||
53 | 1 | 600ns | our @EXPORT_OK = @EXPORT; | ||
54 | |||||
55 | 1 | 7µs | 1 | 264µs | bootstrap Sub::Name $VERSION; # spent 264µs making 1 call to DynaLoader::bootstrap |
56 | |||||
57 | 1 | 6µs | 1; | ||
# spent 23µs within Sub::Name::bootstrap which was called:
# once (23µs+0s) by DynaLoader::bootstrap at line 217 of DynaLoader.pm | |||||
# spent 3.45ms within Sub::Name::subname which was called 1438 times, avg 2µs/call:
# 452 times (1.31ms+0s) by Try::Tiny::try at line 62 of Try/Tiny.pm, avg 3µs/call
# 452 times (871µs+0s) by Try::Tiny::try at line 63 of Try/Tiny.pm, avg 2µs/call
# 316 times (994µs+0s) by Class::MOP::Mixin::HasMethods::add_method at line 83 of Class/MOP/Mixin/HasMethods.pm, avg 3µs/call
# 143 times (100µs+0s) by Type::Library::_mksub or Type::Library::add_type at line 28 of Type/Library.pm, avg 701ns/call
# 44 times (105µs+0s) by Class::MOP::Class::add_around_method_modifier at line 1099 of Class/MOP/Class.pm, avg 2µs/call
# 23 times (54µs+0s) by Moo::_Utils::_name_coderef at line 76 of Moo/_Utils.pm, avg 2µs/call
# 8 times (19µs+0s) by Moose::Exporter::__ANON__[/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Exporter.pm:379] at line 374 of Moose/Exporter.pm, avg 2µs/call |