{
    "mode": "perldoc",
    "parameter": "Class::MOP::Package",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3APackage/json",
    "generated": "2026-06-12T19:00:24Z",
    "sections": {
        "NAME": {
            "content": "Class::MOP::Package - Package Meta Object\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.2200\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The Package Protocol provides an abstraction of a Perl 5 package. A package is basically\nnamespace, and this module provides methods for looking at and changing that namespace's symbol\ntable.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Class::MOP::Package->initialize($packagename, %options)\nThis method creates a new \"Class::MOP::Package\" instance which represents specified package. If\nan existing metaclass object exists for the package, that will be returned instead. No options\nare valid at the package level.\n\nClass::MOP::Package->reinitialize($package, %options)\nThis method forcibly removes any existing metaclass for the package before calling \"initialize\".\nIn contrast to \"initialize\", you may also pass an existing \"Class::MOP::Package\" instance\ninstead of just a package name as $package.\n\nDo not call this unless you know what you are doing.\n\nClass::MOP::Package->create($package, %options)\nCreates a new \"Class::MOP::Package\" instance which represents the specified package, and also\ndoes some initialization of that package. Currently, this just does the same thing as\n\"initialize\", but is overridden in subclasses, such as \"Class::MOP::Class\".\n\nClass::MOP::Package->createanon(%options)\nCreates a new anonymous package. Valid keys for %options are:\n\n\"cache\"\nIf this will be \"true\" (the default is \"false\"), the instance will be cached in\n\"Class::MOP\"'s metaclass cache.\n\n\"weaken\"\nIf this is \"true\" (the default \"true\" when cache is \"false\"), the instance stored in\n\"Class::MOP\"'s metaclass cache will be weakened, so that the anonymous package will be\ngarbage collected when the returned instance goes out of scope.\n\n$metapackage->isanon\nReturns true if the package is an anonymous package.\n\n$metapackage->name\nThis is returns the package's name, as passed to the constructor.\n\n$metapackage->namespace\nThis returns a hash reference to the package's symbol table. The keys are symbol names and the\nvalues are typeglob references.\n\n$metapackage->addpackagesymbol($variablename, $initialvalue)\nThis method accepts a variable name and an optional initial value. The $variablename must\ncontain a leading sigil.\n\nThis method creates the variable in the package's symbol table, and sets it to the initial value\nif one was provided.\n\n$metapackage->getpackagesymbol($variablename)\nGiven a variable name, this method returns the variable as a reference or undef if it does not\nexist. The $variablename must contain a leading sigil.\n\n$metapackage->getoraddpackagesymbol($variablename)\nGiven a variable name, this method returns the variable as a reference. If it does not exist, a\ndefault value will be generated if possible. The $variablename must contain a leading sigil.\n\n$metapackage->haspackagesymbol($variablename)\nReturns true if there is a package variable defined for $variablename. The $variablename must\ncontain a leading sigil.\n\n$metapackage->removepackagesymbol($variablename)\nThis will remove the package variable specified $variablename. The $variablename must contain\na leading sigil.\n\n$metapackage->removepackageglob($globname)\nGiven the name of a glob, this will remove that glob from the package's symbol table. Glob names\ndo not include a sigil. Removing the glob removes all variables and subroutines with the\nspecified name.\n\n$metapackage->listallpackagesymbols($typefilter)\nThis will list all the glob names associated with the current package. These names do not have\nleading sigils.\n\nYou can provide an optional type filter, which should be one of 'SCALAR', 'ARRAY', 'HASH', or\n'CODE'.\n\n$metapackage->getallpackagesymbols($typefilter)\nThis works much like \"listallpackagesymbols\", but it returns a hash reference. The keys are\nglob names and the values are references to the value for that name.\n\nClass::MOP::Package->meta\nThis will return a Class::MOP::Class instance for this class.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   Stevan Little <stevan@cpan.org>\n\n*   Dave Rolsky <autarch@urth.org>\n\n*   Jesse Luehrs <doy@cpan.org>\n\n*   Shawn M Moore <sartak@cpan.org>\n\n*   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Florian Ragwitz <rafl@debian.org>\n\n*   Hans Dieter Pearcey <hdp@cpan.org>\n\n*   Chris Prather <chris@prather.org>\n\n*   Matt S Trout <mstrout@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2006 by Infinity Interactive, Inc.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "Class::MOP::Package - Package Meta Object",
    "flags": [],
    "examples": [],
    "see_also": []
}