1Class::MOP::Package(3)User Contributed Perl DocumentationClass::MOP::Package(3)
2
3
4

NAME

6       Class::MOP::Package - Package Meta Object
7

VERSION

9       version 2.2011
10

DESCRIPTION

12       The Package Protocol provides an abstraction of a Perl 5 package. A
13       package is basically namespace, and this module provides methods for
14       looking at and changing that namespace's symbol table.
15

METHODS

17   Class::MOP::Package->initialize($package_name, %options)
18       This method creates a new "Class::MOP::Package" instance which
19       represents specified package. If an existing metaclass object exists
20       for the package, that will be returned instead. No options are valid at
21       the package level.
22
23   Class::MOP::Package->reinitialize($package, %options)
24       This method forcibly removes any existing metaclass for the package
25       before calling "initialize". In contrast to "initialize", you may also
26       pass an existing "Class::MOP::Package" instance instead of just a
27       package name as $package.
28
29       Do not call this unless you know what you are doing.
30
31   Class::MOP::Package->create($package, %options)
32       Creates a new "Class::MOP::Package" instance which represents the
33       specified package, and also does some initialization of that package.
34       Currently, this just does the same thing as "initialize", but is
35       overridden in subclasses, such as "Class::MOP::Class".
36
37   Class::MOP::Package->create_anon(%options)
38       Creates a new anonymous package. Valid keys for %options are:
39
40       "cache"
41           If this will be "true" (the default is "false"), the instance will
42           be cached in "Class::MOP"'s metaclass cache.
43
44       "weaken"
45           If this is "true" (the default "true" when cache is "false"), the
46           instance stored in "Class::MOP"'s metaclass cache will be weakened,
47           so that the anonymous package will be garbage collected when the
48           returned instance goes out of scope.
49
50   $metapackage->is_anon
51       Returns true if the package is an anonymous package.
52
53   $metapackage->name
54       This is returns the package's name, as passed to the constructor.
55
56   $metapackage->namespace
57       This returns a hash reference to the package's symbol table. The keys
58       are symbol names and the values are typeglob references.
59
60   $metapackage->add_package_symbol($variable_name, $initial_value)
61       This method accepts a variable name and an optional initial value. The
62       $variable_name must contain a leading sigil.
63
64       This method creates the variable in the package's symbol table, and
65       sets it to the initial value if one was provided.
66
67   $metapackage->get_package_symbol($variable_name)
68       Given a variable name, this method returns the variable as a reference
69       or undef if it does not exist. The $variable_name must contain a
70       leading sigil.
71
72   $metapackage->get_or_add_package_symbol($variable_name)
73       Given a variable name, this method returns the variable as a reference.
74       If it does not exist, a default value will be generated if possible.
75       The $variable_name must contain a leading sigil.
76
77   $metapackage->has_package_symbol($variable_name)
78       Returns true if there is a package variable defined for $variable_name.
79       The $variable_name must contain a leading sigil.
80
81   $metapackage->remove_package_symbol($variable_name)
82       This will remove the package variable specified $variable_name. The
83       $variable_name must contain a leading sigil.
84
85   $metapackage->remove_package_glob($glob_name)
86       Given the name of a glob, this will remove that glob from the package's
87       symbol table. Glob names do not include a sigil. Removing the glob
88       removes all variables and subroutines with the specified name.
89
90   $metapackage->list_all_package_symbols($type_filter)
91       This will list all the glob names associated with the current package.
92       These names do not have leading sigils.
93
94       You can provide an optional type filter, which should be one of
95       'SCALAR', 'ARRAY', 'HASH', or 'CODE'.
96
97   $metapackage->get_all_package_symbols($type_filter)
98       This works much like "list_all_package_symbols", but it returns a hash
99       reference. The keys are glob names and the values are references to the
100       value for that name.
101
102   Class::MOP::Package->meta
103       This will return a Class::MOP::Class instance for this class.
104

AUTHORS

106       ·   Stevan Little <stevan.little@iinteractive.com>
107
108       ·   Dave Rolsky <autarch@urth.org>
109
110       ·   Jesse Luehrs <doy@tozt.net>
111
112       ·   Shawn M Moore <code@sartak.org>
113
114       ·   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
115
116       ·   Karen Etheridge <ether@cpan.org>
117
118       ·   Florian Ragwitz <rafl@debian.org>
119
120       ·   Hans Dieter Pearcey <hdp@weftsoar.net>
121
122       ·   Chris Prather <chris@prather.org>
123
124       ·   Matt S Trout <mst@shadowcat.co.uk>
125
127       This software is copyright (c) 2006 by Infinity Interactive, Inc.
128
129       This is free software; you can redistribute it and/or modify it under
130       the same terms as the Perl 5 programming language system itself.
131
132
133
134perl v5.30.0                      2019-07-26            Class::MOP::Package(3)
Impressum