File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Sub/Name.pm |
Statements Executed | 20 |
Statement Execution Time | 232µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
338 | 5 | 5 | 923µs | 923µs | subname (xsub) | Sub::Name::
1 | 1 | 1 | 68µs | 68µs | BEGIN@42 | Sub::Name::
1 | 1 | 2 | 16µs | 16µs | bootstrap (xsub) | Sub::Name::
1 | 1 | 1 | 9µs | 26µs | BEGIN@45 | Sub::Name::
1 | 1 | 1 | 9µs | 16µs | BEGIN@44 | Sub::Name::
1 | 1 | 1 | 7µs | 61µs | BEGIN@49 | Sub::Name::
1 | 1 | 1 | 7µs | 3.55ms | BEGIN@50 | 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 | 3 | 72µs | 1 | 68µs | # spent 68µs within Sub::Name::BEGIN@42 which was called
# once (68µs+0s) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 42 # spent 68µs making 1 call to Sub::Name::BEGIN@42 |
43 | |||||
44 | 3 | 26µs | 2 | 24µs | # spent 16µs (9+7) within Sub::Name::BEGIN@44 which was called
# once (9µs+7µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 44 # spent 16µs making 1 call to Sub::Name::BEGIN@44
# spent 7µs making 1 call to strict::import |
45 | 3 | 36µs | 2 | 44µs | # spent 26µs (9+17) within Sub::Name::BEGIN@45 which was called
# once (9µs+17µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 45 # spent 26µs making 1 call to Sub::Name::BEGIN@45
# spent 17µs making 1 call to warnings::import |
46 | |||||
47 | 1 | 700ns | our $VERSION = '0.04'; | ||
48 | |||||
49 | 3 | 23µs | 2 | 115µs | # spent 61µs (7+54) within Sub::Name::BEGIN@49 which was called
# once (7µs+54µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 49 # spent 61µs making 1 call to Sub::Name::BEGIN@49
# spent 54µs making 1 call to base::import |
50 | 3 | 61µs | 2 | 7.09ms | # spent 3.55ms (7µs+3.54) within Sub::Name::BEGIN@50 which was called
# once (7µs+3.54ms) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 50 # spent 3.55ms making 1 call to Sub::Name::BEGIN@50
# spent 3.54ms making 1 call to base::import |
51 | |||||
52 | 1 | 900ns | our @EXPORT = qw(subname); | ||
53 | 1 | 500ns | our @EXPORT_OK = @EXPORT; | ||
54 | |||||
55 | 1 | 5µs | 1 | 295µs | bootstrap Sub::Name $VERSION; # spent 295µs making 1 call to DynaLoader::bootstrap |
56 | |||||
57 | 1 | 7µs | 1; | ||
# spent 16µs within Sub::Name::bootstrap which was called
# once (16µs+0s) by DynaLoader::bootstrap at line 227 of DynaLoader.pm | |||||
# spent 923µs within Sub::Name::subname which was called 338 times, avg 3µs/call:
# 288 times (819µs+0s) by Class::MOP::Mixin::HasMethods::add_method at line 66 of Class/MOP/Mixin/HasMethods.pm, avg 3µs/call
# 36 times (79µs+0s) by Class::MOP::Class::add_around_method_modifier at line 705 of Class/MOP/Class.pm, avg 2µs/call
# 8 times (14µs+0s) by Moose::Exporter::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Exporter.pm:263] at line 258 of Moose/Exporter.pm, avg 2µs/call
# 5 times (10µs+0s) by Moose::Meta::TypeConstraint::_compile_subtype at line 266 of Moose/Meta/TypeConstraint.pm, avg 2µs/call
# once (2µs+0s) by Moose::Meta::TypeConstraint::_compile_type at line 279 of Moose/Meta/TypeConstraint.pm |