X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FPackage.pm;h=e87df5566a76f15a1dee57369e9314671068335b;hb=d004c8d565f9b314da7652e9368aeb4587ffaa3d;hp=fa60c6bbeeec38b4a615d6b99a8d4a86d67d5f00;hpb=2440993d9723281b7f3e8cfd0b54e9dc7bfe1944;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index fa60c6b..e87df55 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -8,7 +8,7 @@ use Scalar::Util 'blessed', 'reftype'; use Carp 'confess'; use Package::Stash; -our $VERSION = '1.08'; +our $VERSION = '1.12'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -103,34 +103,44 @@ sub namespace { sub add_package_symbol { my $self = shift; - $self->_package_stash->add_package_symbol(@_); + $self->_package_stash->add_symbol(@_); } sub remove_package_glob { my $self = shift; - $self->_package_stash->remove_package_glob(@_); + $self->_package_stash->remove_glob(@_); } # ... these functions deal with stuff on the namespace level sub has_package_symbol { my $self = shift; - $self->_package_stash->has_package_symbol(@_); + $self->_package_stash->has_symbol(@_); } sub get_package_symbol { my $self = shift; - $self->_package_stash->get_package_symbol(@_); + $self->_package_stash->get_symbol(@_); +} + +sub get_or_add_package_symbol { + my $self = shift; + $self->_package_stash->get_or_add_symbol(@_); } sub remove_package_symbol { my $self = shift; - $self->_package_stash->remove_package_symbol(@_); + $self->_package_stash->remove_symbol(@_); } sub list_all_package_symbols { my $self = shift; - $self->_package_stash->list_all_package_symbols(@_); + $self->_package_stash->list_all_symbols(@_); +} + +sub get_all_package_symbols { + my $self = shift; + $self->_package_stash->get_all_symbols(@_); } 1; @@ -191,6 +201,12 @@ Given a variable name, this method returns the variable as a reference or undef if it does not exist. The C<$variable_name> must contain a leading sigil. +=item B<< $metapackage->get_or_add_package_symbol($variable_name) >> + +Given a variable name, this method returns the variable as a reference. +If it does not exist, a default value will be generated if possible. The +C<$variable_name> must contain a leading sigil. + =item B<< $metapackage->has_package_symbol($variable_name) >> Returns true if there is a package variable defined for