{
    "mode": "info",
    "parameter": "Sub::Identify",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/Sub%3A%3AIdentify/json",
    "generated": "2026-07-05T11:50:51Z",
    "synopsis": "use Sub::Identify ':all';\nmy $subname = subname( $somecoderef );\nmy $packagename = stashname( $somecoderef );\n# or, to get all at once...\nmy $fullyqualifiedname = subfullname( $somecoderef );\ndefined $subname\nand say \"this coderef points to sub $subname in package $packagename\";\nmy ($file, $line) = getcodelocation( $somecoderef );\n$file\nand say \"this coderef is defined at line $line in file $file\";\nissubconstant( $somecoderef )\nand say \"this coderef points to a constant subroutine\";",
    "sections": {
        "Sub::Identify(3pm)    User Contributed Perl Documentation   Sub::Identify(3pm)": {
            "content": "",
            "subsections": []
        },
        "NAME": {
            "content": "Sub::Identify - Retrieve names of code references\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Sub::Identify ':all';\nmy $subname = subname( $somecoderef );\nmy $packagename = stashname( $somecoderef );\n# or, to get all at once...\nmy $fullyqualifiedname = subfullname( $somecoderef );\ndefined $subname\nand say \"this coderef points to sub $subname in package $packagename\";\nmy ($file, $line) = getcodelocation( $somecoderef );\n$file\nand say \"this coderef is defined at line $line in file $file\";\nissubconstant( $somecoderef )\nand say \"this coderef points to a constant subroutine\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "\"Sub::Identify\" allows you to retrieve the real name of code\nreferences.\n\nIt provides six functions, all of them taking a code reference.\n\n\"subname\" returns the name of the code reference passed as an argument\n(or \"ANON\" if it's an anonymous code reference), \"stashname\"\nreturns its package, and \"subfullname\" returns the concatenation of\nthe two.\n\n\"getcodeinfo\" returns a list of two elements, the package and the\nsubroutine name (in case of you want both and are worried by the\nspeed.)\n\nIn case of subroutine aliasing, those functions always return the\noriginal name.\n\n\"getcodelocation\" returns a two-element list containing the file name\nand the line number where the subroutine has been defined.\n\n\"issubconstant\" returns a boolean value indicating whether the\nsubroutine is a constant or not.\n\nPure-Perl version\nBy default \"Sub::Identify\" tries to load an XS implementation of the\n\"getcodeinfo\", \"getcodelocation\" and (on perl versions 5.16.0 and\nlater) \"issubconstant\" functions, for speed; if that fails, or if the\nenvironment variable \"PERLSUBIDENTIFYPP\" is defined to a true value,\nit will fall back to a pure perl implementation, that uses perl's\nintrospection mechanism, provided by the \"B\" module.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Sub::Util, part of the module distribution Scalar::List::Utils since\nversion 1.40. Since this will be a core module starting with perl\n5.22.0, it is encouraged to migrate to Sub::Util when possible.\n\nSub::Name\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "A git repository for the sources is at\n<https://github.com/rgs/Sub-Identify>.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "(c) Rafael Garcia-Suarez (rgs at consttype dot org) 2005, 2008, 2012,\n2014, 2015\n\nThis program is free software; you may redistribute it and/or modify it\nunder the same terms as Perl itself.\n\nperl v5.34.0                      2022-02-06                Sub::Identify(3pm)",
            "subsections": []
        }
    },
    "summary": "Sub::Identify - Retrieve names of code references",
    "flags": [],
    "examples": [],
    "see_also": []
}