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

NAME

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

DESCRIPTION

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

METHODS

14       Class::MOP::Package->initialize($package_name)
15           This method creates a new "Class::MOP::Package" instance which
16           represents specified package. If an existing metaclass object
17           exists for the package, that will be returned instead.
18
19       Class::MOP::Package->reinitialize($package)
20           This method forcibly removes any existing metaclass for the package
21           before calling "initialize". In contrast to "initialize", you may
22           also pass an existing "Class::MOP::Package" instance instead of
23           just a package name as $package.
24
25           Do not call this unless you know what you are doing.
26
27       $metapackage->name
28           This is returns the package's name, as passed to the constructor.
29
30       $metapackage->namespace
31           This returns a hash reference to the package's symbol table. The
32           keys are symbol names and the values are typeglob references.
33
34       $metapackage->add_package_symbol($variable_name, $initial_value)
35           This method accepts a variable name and an optional initial value.
36           The $variable_name must contain a leading sigil.
37
38           This method creates the variable in the package's symbol table, and
39           sets it to the initial value if one was provided.
40
41       $metapackage->get_package_symbol($variable_name)
42           Given a variable name, this method returns the variable as a
43           reference or undef if it does not exist. The $variable_name must
44           contain a leading sigil.
45
46       $metapackage->has_package_symbol($variable_name)
47           Returns true if there is a package variable defined for
48           $variable_name. The $variable_name must contain a leading sigil.
49
50       $metapackage->remove_package_symbol($variable_name)
51           This will remove the package variable specified $variable_name. The
52           $variable_name must contain a leading sigil.
53
54       $metapackage->remove_package_glob($glob_name)
55           Given the name of a glob, this will remove that glob from the
56           package's symbol table. Glob names do not include a sigil. Removing
57           the glob removes all variables and subroutines with the specified
58           name.
59
60       $metapackage->list_all_package_symbols($type_filter)
61           This will list all the glob names associated with the current
62           package. These names do not have leading sigils.
63
64           You can provide an optional type filter, which should be one of
65           'SCALAR', 'ARRAY', 'HASH', or 'CODE'.
66
67       $metapackage->get_all_package_symbols($type_filter)
68           This works much like "list_all_package_symbols", but it returns a
69           hash reference. The keys are glob names and the values are
70           references to the value for that name.
71
72       Class::MOP::Package->meta
73           This will return a Class::MOP::Class instance for this class.
74

AUTHORS

76       Stevan Little <stevan@iinteractive.com>
77
79       Copyright 2006-2010 by Infinity Interactive, Inc.
80
81       <http://www.iinteractive.com>
82
83       This library is free software; you can redistribute it and/or modify it
84       under the same terms as Perl itself.
85
86
87
88perl v5.12.2                      2010-09-13            Class::MOP::Package(3)
Impressum