increment $VERSION after 0.26 release
[p5sagit/Sub-Name.git] / lib / Sub / Name.pm
CommitLineData
16c23894 1package Sub::Name;
21b37dd9 2# ABSTRACT: (Re)name a sub
1002e78c 3# KEYWORDS: subroutine function utility name rename symbol
16c23894 4
54595ea8 5=pod
16c23894 6
7=head1 SYNOPSIS
8
9 use Sub::Name;
10
11 subname $name, $subref;
12
13 $subref = subname foo => sub { ... };
14
15=head1 DESCRIPTION
16
d73d8321 17This module has only one function, which is also exported by default:
16c23894 18
30f18ad8 19=for stopwords subname
20
16c23894 21=head2 subname NAME, CODEREF
22
a0f015f5 23Assigns a new name to referenced sub. If package specification is omitted in
16c23894 24the name, then the current package is used. The return value is the sub.
25
a0f015f5 26The name is only used for informative routines (caller, Carp, etc). You won't
27be able to actually invoke the sub by the given name. To allow that, you need
16c23894 28to do glob-assignment yourself.
29
a0f015f5 30Note that for anonymous closures (subs that reference lexicals declared outside
31the sub itself) you can name each instance of the closure differently, which
d73d8321 32can be very useful for debugging.
16c23894 33
fa1e9525 34=head1 SEE ALSO
35
691b40bc 36=for :list
37* L<Sub::Identify> - for getting information about subs
86f08d91 38* L<Sub::Util> - set_subname is another implementation of C<subname>
fa1e9525 39
30f18ad8 40=for stopwords cPanel
41
d2e2a4b9 42=head1 COPYRIGHT AND LICENSE
43
54595ea8 44This software is copyright (c) 2004, 2008 by Matthijs van Duin, all rights reserved;
45copyright (c) 2014 cPanel Inc., all rights reserved.
16c23894 46
a0f015f5 47This program is free software; you can redistribute it and/or modify
16c23894 48it under the same terms as Perl itself.
49
50=cut
51
52use 5.006;
53
54use strict;
55use warnings;
56
d324c819 57our $VERSION = '0.27';
dfd7ef25 58
3ae12aec 59use Exporter ();
60*import = \&Exporter::import;
16c23894 61
62our @EXPORT = qw(subname);
63our @EXPORT_OK = @EXPORT;
64
54595ea8 65use XSLoader;
66XSLoader::load(
67 __PACKAGE__,
dfd7ef25 68 $VERSION,
54595ea8 69);
16c23894 70
711;