1Sub::Name(3) User Contributed Perl Documentation Sub::Name(3)
2
3
4
6 Sub::Name - (Re)name a sub
7
9 version 0.27
10
12 use Sub::Name;
13
14 subname $name, $subref;
15
16 $subref = subname foo => sub { ... };
17
19 This module has only one function, which is also exported by default:
20
21 subname NAME, CODEREF
22 Assigns a new name to referenced sub. If package specification is
23 omitted in the name, then the current package is used. The return
24 value is the sub.
25
26 The name is only used for informative routines (caller, Carp, etc).
27 You won't be able to actually invoke the sub by the given name. To
28 allow that, you need to do glob-assignment yourself.
29
30 Note that for anonymous closures (subs that reference lexicals declared
31 outside the sub itself) you can name each instance of the closure
32 differently, which can be very useful for debugging.
33
35 • Sub::Identify - for getting information about subs
36
37 • Sub::Util - set_subname is another implementation of "subname"
38
40 Bugs may be submitted through the RT bug tracker
41 <https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-Name> (or
42 bug-Sub-Name@rt.cpan.org <mailto:bug-Sub-Name@rt.cpan.org>).
43
44 There is also an irc channel available for users of this distribution,
45 at "#toolchain" on "irc.perl.org" <irc://irc.perl.org/#toolchain>.
46
48 Matthijs van Duin <xmath@cpan.org>
49
51 • Karen Etheridge <ether@cpan.org>
52
53 • Graham Knop <haarg@haarg.org>
54
55 • Leon Timmermans <fawaka@gmail.com>
56
57 • Florian Ragwitz <rafl@debian.org>
58
59 • Reini Urban <rurban@cpan.org>
60
61 • Matthijs van Duin <xmath-no-spam@nospam.cpan.org>
62
63 • Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
64
65 • gfx <gfuji@cpan.org>
66
67 • Aristotle Pagaltzis <pagaltzis@gmx.de>
68
69 • Alexander Bluhm <alexander.bluhm@gmx.net>
70
71 • J.R. Mash <jmash.code@gmail.com>
72
74 This software is copyright (c) 2004, 2008 by Matthijs van Duin, all
75 rights reserved; copyright (c) 2014 cPanel Inc., all rights reserved.
76
77 This program is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
79
80
81
82perl v5.38.0 2023-07-21 Sub::Name(3)