Class::MOP::Package - Package Meta Object


Class::MOP::Package - Package Meta Object


This is an abstraction of a Perl 5 package, it is a superclass of the Class::MOP::Class manpage and provides all of the symbol table introspection methods.


Returns a metaclass for this package.

initialize ($package_name)
This will initialize a Class::MOP::Package instance which represents the package of $package_name.

This is a read-only attribute which returns the package name for the given instance.

This returns a HASH reference to the symbol table. The keys of the HASH are the symbol names, and the values are typeglob references.

add_package_symbol ($variable_name, ?$initial_value)
Given a $variable_name, which must contain a leading sigil, this method will create that variable within the package which houses the class. It also takes an optional $initial_value, which must be a reference of the same type as the sigil of the $variable_name implies.

get_package_symbol ($variable_name)
This will return a reference to the package variable in $variable_name.

has_package_symbol ($variable_name)
Returns true (1) if there is a package variable defined for $variable_name, and false (0) otherwise.

remove_package_symbol ($variable_name)
This will attempt to remove the package variable at $variable_name.

remove_package_glob ($glob_name)
This will attempt to remove the entire typeglob associated with $glob_name from the package.

list_all_package_symbols (?$type_filter)
This will list all the glob names associated with the current package. By inspecting the globs returned you can discern all the variables in the package.

By passing a $type_filter, you can limit the list to only those which match the filter (either SCALAR, ARRAY, HASH or CODE).


Stevan Little <>


Copyright 2006-2008 by Infinity Interactive, Inc.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

 Class::MOP::Package - Package Meta Object