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