1Sub::Name(3)          User Contributed Perl Documentation         Sub::Name(3)
2
3
4

NAME

6       Sub::Name - (re)name a sub
7

SYNOPSIS

9           use Sub::Name;
10
11           subname $name, $subref;
12
13           $subref = subname foo => sub { ... };
14

DESCRIPTION

16       This module has only one function, which is also exported by default:
17
18       subname NAME, CODEREF
19
20       Assigns a new name to referenced sub.  If package specification is
21       omitted in the name, then the current package is used.  The return
22       value is the sub.
23
24       The name is only used for informative routines (caller, Carp, etc).
25       You won't be able to actually invoke the sub by the given name.  To
26       allow that, you need to do glob-assignment yourself.
27
28       Note that for anonymous closures (subs that reference lexicals declared
29       outside the sub itself) you can name each instance of the closure dif‐
30       ferently, which can be very useful for debugging.
31

AUTHOR

33       Matthijs van Duin <xmath@cpan.org>
34
35       Copyright (C) 2004  Matthijs van Duin.  All rights reserved.  This pro‐
36       gram is free software; you can redistribute it and/or modify it under
37       the same terms as Perl itself.
38
39
40
41perl v5.8.8                       2008-02-20                      Sub::Name(3)
Impressum