line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sub::Name; # git description: v0.22-4-gd2ca7a1 |
2
|
|
|
|
|
|
|
# ABSTRACT: (Re)name a sub |
3
|
|
|
|
|
|
|
# KEYWORDS: subroutine function utility name rename symbol |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#pod =pod |
6
|
|
|
|
|
|
|
#pod |
7
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
8
|
|
|
|
|
|
|
#pod |
9
|
|
|
|
|
|
|
#pod use Sub::Name; |
10
|
|
|
|
|
|
|
#pod |
11
|
|
|
|
|
|
|
#pod subname $name, $subref; |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod $subref = subname foo => sub { ... }; |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod This module has only one function, which is also exported by default: |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod =for stopwords subname |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod =head2 subname NAME, CODEREF |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod Assigns a new name to referenced sub. If package specification is omitted in |
24
|
|
|
|
|
|
|
#pod the name, then the current package is used. The return value is the sub. |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod The name is only used for informative routines (caller, Carp, etc). You won't |
27
|
|
|
|
|
|
|
#pod be able to actually invoke the sub by the given name. To allow that, you need |
28
|
|
|
|
|
|
|
#pod to do glob-assignment yourself. |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod Note that for anonymous closures (subs that reference lexicals declared outside |
31
|
|
|
|
|
|
|
#pod the sub itself) you can name each instance of the closure differently, which |
32
|
|
|
|
|
|
|
#pod can be very useful for debugging. |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod =for :list |
37
|
|
|
|
|
|
|
#pod * L - for getting information about subs |
38
|
|
|
|
|
|
|
#pod * L - set_subname is another implementation of C |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod =for stopwords cPanel |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod =head1 COPYRIGHT AND LICENSE |
43
|
|
|
|
|
|
|
#pod |
44
|
|
|
|
|
|
|
#pod This software is copyright (c) 2004, 2008 by Matthijs van Duin, all rights reserved; |
45
|
|
|
|
|
|
|
#pod copyright (c) 2014 cPanel Inc., all rights reserved. |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod This program is free software; you can redistribute it and/or modify |
48
|
|
|
|
|
|
|
#pod it under the same terms as Perl itself. |
49
|
|
|
|
|
|
|
#pod |
50
|
|
|
|
|
|
|
#pod =cut |
51
|
|
|
|
|
|
|
|
52
|
5
|
|
|
5
|
|
84086
|
use 5.006; |
|
5
|
|
|
|
|
15
|
|
53
|
|
|
|
|
|
|
|
54
|
5
|
|
|
5
|
|
21
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
109
|
|
55
|
5
|
|
|
5
|
|
18
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
217
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
our $VERSION = '0.23'; # TRIAL |
58
|
|
|
|
|
|
|
|
59
|
5
|
|
|
5
|
|
20
|
use Exporter (); |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
274
|
|
60
|
|
|
|
|
|
|
*import = \&Exporter::import; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
our @EXPORT = qw(subname); |
63
|
|
|
|
|
|
|
our @EXPORT_OK = @EXPORT; |
64
|
|
|
|
|
|
|
|
65
|
5
|
|
|
5
|
|
24
|
use XSLoader; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
220
|
|
66
|
|
|
|
|
|
|
XSLoader::load( |
67
|
|
|
|
|
|
|
__PACKAGE__, |
68
|
|
|
|
|
|
|
$VERSION, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |