3bf1a28e49fcc78a5ee2c111fc67ea6a6d2a33bf
[p5sagit/Sub-Name.git] / README
1 $Id: README,v 1.4 2004/08/18 12:03:42 xmath Exp $
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
26     This module has two functions to assign a new name to a sub -- in
27     particular an anonymous sub -- which is displayed in tracebacks and
28     such. Both functions are exported by default.
29
30   subname NAME, CODEREF
31     Assigns a new name to referenced sub. If package specification is
32     omitted in the name, then the current package is used. The return value
33     is the sub.
34
35     The name is only used for informative routines (caller, Carp, etc). You
36     won't be able to actually invoke the sub by the given name. To allow
37     that, you need to do glob-assignment yourself.
38
39     Note that for closures (anonymous subs that reference lexicals outside
40     the sub itself) you can name each instance of the closure differently,
41     which can be very useful for debugging.
42
43 AUTHOR
44     Matthijs van Duin <xmath@cpan.org>
45
46     Copyright (C) 2004 Matthijs van Duin. All rights reserved. This program
47     is free software; you can redistribute it and/or modify it under the
48     same terms as Perl itself.