X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FPackage.pm;h=9fcf365a011a44673cb150c4ee82b653ba846453;hb=81b5e774319e5a9b83f09aae1b101b25ff7af350;hp=7def2480959fd86b1ec06434db97072963b1c37c;hpb=67f694add1dd6c3c8d78a7aa991e65ff71dd1395;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 7def248..9fcf365 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.04'; +our $VERSION = '1.09'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -123,6 +123,11 @@ sub get_package_symbol { $self->_package_stash->get_package_symbol(@_); } +sub get_or_add_package_symbol { + my $self = shift; + $self->_package_stash->get_or_add_package_symbol(@_); +} + sub remove_package_symbol { my $self = shift; $self->_package_stash->remove_package_symbol(@_); @@ -191,6 +196,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