{
    "mode": "perldoc",
    "parameter": "Sub::Name",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Sub%3A%3AName/json",
    "generated": "2026-06-12T04:45:03Z",
    "synopsis": "use Sub::Name;\nsubname $name, $subref;\n$subref = subname foo => sub { ... };",
    "sections": {
        "NAME": {
            "content": "Sub::Name - (Re)name a sub\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 0.26\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Sub::Name;\n\nsubname $name, $subref;\n\n$subref = subname foo => sub { ... };\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module has only one function, which is also exported by default:\n\nsubname NAME, CODEREF\nAssigns a new name to referenced sub. If package specification is omitted in the name, then the\ncurrent package is used. The return value is the sub.\n\nThe name is only used for informative routines (caller, Carp, etc). You won't be able to\nactually invoke the sub by the given name. To allow that, you need to do glob-assignment\nyourself.\n\nNote that for anonymous closures (subs that reference lexicals declared outside the sub itself)\nyou can name each instance of the closure differently, which can be very useful for debugging.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "*   Sub::Identify - for getting information about subs\n\n*   Sub::Util - setsubname is another implementation of \"subname\"\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs may be submitted through the RT bug tracker\n<https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-Name> (or bug-Sub-Name@rt.cpan.org\n<mailto:bug-Sub-Name@rt.cpan.org>).\n\nThere is also an irc channel available for users of this distribution, at \"#toolchain\" on\n\"irc.perl.org\" <irc://irc.perl.org/#toolchain>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Matthijs van Duin <xmath@cpan.org>\n",
            "subsections": []
        },
        "CONTRIBUTORS": {
            "content": "*   Karen Etheridge <ether@cpan.org>\n\n*   Graham Knop <haarg@haarg.org>\n\n*   Leon Timmermans <fawaka@gmail.com>\n\n*   Reini Urban <rurban@cpan.org>\n\n*   Florian Ragwitz <rafl@debian.org>\n\n*   Matthijs van Duin <xmath-no-spam@nospam.cpan.org>\n\n*   Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>\n\n*   gfx <gfuji@cpan.org>\n\n*   Aristotle Pagaltzis <pagaltzis@gmx.de>\n\n*   J.R. Mash <jmash.code@gmail.com>\n\n*   Alexander Bluhm <alexander.bluhm@gmx.net>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2004, 2008 by Matthijs van Duin, all rights reserved; copyright\n(c) 2014 cPanel Inc., all rights reserved.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "Sub::Name - (Re)name a sub",
    "flags": [],
    "examples": [],
    "see_also": []
}