{
    "mode": "perldoc",
    "parameter": "Class::ISA",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AISA/json",
    "generated": "2026-06-03T08:26:37Z",
    "synopsis": "# Suppose you go: use Food::Fishstick, and that uses and\n# inherits from other things, which in turn use and inherit\n# from other things.  And suppose, for sake of brevity of\n# example, that their ISA tree is the same as:\n@Food::Fishstick::ISA = qw(Food::Fish  Life::Fungus  Chemicals);\n@Food::Fish::ISA = qw(Food);\n@Food::ISA = qw(Matter);\n@Life::Fungus::ISA = qw(Life);\n@Chemicals::ISA = qw(Matter);\n@Life::ISA = qw(Matter);\n@Matter::ISA = qw();\nuse Class::ISA;\nprint \"Food::Fishstick path is:\\n \",\njoin(\", \", Class::ISA::superpath('Food::Fishstick')),\n\"\\n\";\nThat prints:\nFood::Fishstick path is:\nFood::Fish, Food, Matter, Life::Fungus, Life, Chemicals",
    "sections": {
        "NAME": {
            "content": "Class::ISA - report the search path for a class's ISA tree\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# Suppose you go: use Food::Fishstick, and that uses and\n# inherits from other things, which in turn use and inherit\n# from other things.  And suppose, for sake of brevity of\n# example, that their ISA tree is the same as:\n\n@Food::Fishstick::ISA = qw(Food::Fish  Life::Fungus  Chemicals);\n@Food::Fish::ISA = qw(Food);\n@Food::ISA = qw(Matter);\n@Life::Fungus::ISA = qw(Life);\n@Chemicals::ISA = qw(Matter);\n@Life::ISA = qw(Matter);\n@Matter::ISA = qw();\n\nuse Class::ISA;\nprint \"Food::Fishstick path is:\\n \",\njoin(\", \", Class::ISA::superpath('Food::Fishstick')),\n\"\\n\";\n\nThat prints:\n\nFood::Fishstick path is:\nFood::Fish, Food, Matter, Life::Fungus, Life, Chemicals\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Suppose you have a class (like Food::Fish::Fishstick) that is derived, via its @ISA, from one or\nmore superclasses (as Food::Fish::Fishstick is from Food::Fish, Life::Fungus, and Chemicals),\nand some of those superclasses may themselves each be derived, via its @ISA, from one or more\nsuperclasses (as above).\n\nWhen, then, you call a method in that class ($fishstick->calories), Perl first searches there\nfor that method, but if it's not there, it goes searching in its superclasses, and so on, in a\ndepth-first (or maybe \"height-first\" is the word) search. In the above example, it'd first look\nin Food::Fish, then Food, then Matter, then Life::Fungus, then Life, then Chemicals.\n\nThis library, Class::ISA, provides functions that return that list -- the list (in order) of\nnames of classes Perl would search to find a method, with no duplicates.\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "the function Class::ISA::superpath($CLASS)\nThis returns the ordered list of names of classes that Perl would search thru in order to\nfind a method, with no duplicates in the list. $CLASS is not included in the list. UNIVERSAL\nis not included -- if you need to consider it, add it to the end.\n\nthe function Class::ISA::selfandsuperpath($CLASS)\nJust like \"superpath\", except that $CLASS is included as the first element.\n\nthe function Class::ISA::selfandsuperversions($CLASS)\nThis returns a hash whose keys are $CLASS and its (super-)superclasses, and whose values are\nthe contents of each class's $VERSION (or undef, for classes with no $VERSION).\n\nThe code for selfandsuperversions is meant to serve as an example for precisely the kind\nof tasks I anticipate that selfandsuperpath and superpath will be used for. You are\nstrongly advised to read the source for selfandsuperversions, and the comments there.\n",
            "subsections": []
        },
        "CAUTIONARY NOTES": {
            "content": "* Class::ISA doesn't export anything. You have to address the functions with a \"Class::ISA::\" on\nthe front.\n\n* Contrary to its name, Class::ISA isn't a class; it's just a package. Strange, isn't it?\n\n* Say you have a loop in the ISA tree of the class you're calling one of the Class::ISA\nfunctions on: say that Food inherits from Matter, but Matter inherits from Food (for sake of\nargument). If Perl, while searching for a method, actually discovers this cyclicity, it will\nthrow a fatal error. The functions in Class::ISA effectively ignore this cyclicity; the\nClass::ISA algorithm is \"never go down the same path twice\", and cyclicities are just a special\ncase of that.\n\n* The Class::ISA functions just look at @ISAs. But theoretically, I suppose, AUTOLOADs could\nbypass Perl's ISA-based search mechanism and do whatever they please. That would be bad\nbehavior, tho; and I try not to think about that.\n\n* If Perl can't find a method anywhere in the ISA tree, it then looks in the magical class\nUNIVERSAL. This is rarely relevant to the tasks that I expect Class::ISA functions to be put to,\nbut if it matters to you, then instead of this:\n\n@supers = Class::Tree::superpath($class);\n\ndo this:\n\n@supers = (Class::Tree::superpath($class), 'UNIVERSAL');\n\nAnd don't say no-one ever told ya!\n\n* When you call them, the Class::ISA functions look at @ISAs anew -- that is, there is no\nmemoization, and so if ISAs change during runtime, you get the current ISA tree's path, not\nanything memoized. However, changing ISAs at runtime is probably a sign that you're out of your\nmind!\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "Copyright (c) 1999-2009 Sean M. Burke. All rights reserved.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Sean M. Burke \"sburke@cpan.org\"\n",
            "subsections": []
        },
        "MAINTAINER": {
            "content": "Maintained by Steffen Mueller \"smueller@cpan.org\".\n",
            "subsections": []
        }
    },
    "summary": "Class::ISA - report the search path for a class's ISA tree",
    "flags": [],
    "examples": [],
    "see_also": []
}