Commit | Line | Data |
979516cc |
1 | Sub::Name 0.04 |
16c23894 |
2 | |
3 | To install this module type the following: |
4 | |
5 | perl Makefile.PL |
6 | make |
7 | make test |
8 | make install |
9 | |
10 | |
11 | Module documentation: |
12 | |
13 | NAME |
14 | Sub::Name - (re)name a sub |
15 | |
16 | SYNOPSIS |
17 | use Sub::Name; |
18 | |
19 | subname $name, $subref; |
20 | |
21 | $subref = subname foo => sub { ... }; |
22 | |
23 | DESCRIPTION |
d73d8321 |
24 | This module has only one function, which is also exported by default: |
16c23894 |
25 | |
26 | subname NAME, CODEREF |
27 | Assigns a new name to referenced sub. If package specification is |
28 | omitted in the name, then the current package is used. The return value |
29 | is the sub. |
30 | |
31 | The name is only used for informative routines (caller, Carp, etc). You |
32 | won't be able to actually invoke the sub by the given name. To allow |
33 | that, you need to do glob-assignment yourself. |
34 | |
d73d8321 |
35 | Note that for anonymous closures (subs that reference lexicals declared |
36 | outside the sub itself) you can name each instance of the closure |
37 | differently, which can be very useful for debugging. |
16c23894 |
38 | |
39 | AUTHOR |
40 | Matthijs van Duin <xmath@cpan.org> |
41 | |
979516cc |
42 | Copyright (C) 2004, 2008 Matthijs van Duin. All rights reserved. This |
43 | program is free software; you can redistribute it and/or modify it under |
44 | the same terms as Perl itself. |