7 Sub::Name - (Re)name a sub
17 subname $name, $subref;
19 $subref = subname foo => sub { ... };
23 This module has only one function, which is also exported by default:
25 =for stopwords subname
27 =head2 subname NAME, CODEREF
29 Assigns a new name to referenced sub. If package specification is omitted in
30 the name, then the current package is used. The return value is the sub.
32 The name is only used for informative routines (caller, Carp, etc). You won't
33 be able to actually invoke the sub by the given name. To allow that, you need
34 to do glob-assignment yourself.
36 Note that for anonymous closures (subs that reference lexicals declared outside
37 the sub itself) you can name each instance of the closure differently, which
38 can be very useful for debugging.
46 L<Sub::Identify> - for getting information about subs
50 L<Sub::Util> - set_subname is another implementation of C<subname>
58 Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-Name>
59 (or L<bug-Sub-Name@rt.cpan.org|mailto:bug-Sub-Name@rt.cpan.org>).
61 There is also an irc channel available for users of this distribution, at
62 L<C<#toolchain> on C<irc.perl.org>|irc://irc.perl.org/#toolchain>.
66 Matthijs van Duin <xmath@cpan.org>
70 =for stopwords Karen Etheridge Florian Ragwitz Leon Timmermans Matthijs van Duin Reini Urban gfx Dagfinn Ilmari Mannsåker Aristotle Pagaltzis J.R. Mash
76 Karen Etheridge <ether@cpan.org>
80 Florian Ragwitz <rafl@debian.org>
84 Leon Timmermans <fawaka@gmail.com>
88 Matthijs van Duin <xmath-no-spam@nospam.cpan.org>
92 Reini Urban <rurban@cpanel.net>
100 Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
104 Aristotle Pagaltzis <pagaltzis@gmx.de>
108 J.R. Mash <jmash.code@gmail.com>
112 =head1 COPYRIGHT AND LICENSE
114 This software is copyright (c) 2004, 2008 by Matthijs van Duin, all rights reserved;
115 copyright (c) 2014 cPanel Inc., all rights reserved.
117 This program is free software; you can redistribute it and/or modify
118 it under the same terms as Perl itself.