Revision history for Perl extension Class-MOP.
+ [OTHER]
+
+ * Use get_or_add_package_symbol when we intend for it to autovivify, in
+ preparation for changes in Package::Stash. (doy)
+
1.08 Mon, Sep 13, 2010
[BUG FIXES]
sub superclasses {
my $self = shift;
- my $isa = $self->get_package_symbol(
+ my $isa = $self->get_or_add_package_symbol(
{ sigil => '@', type => 'ARRAY', name => 'ISA' } );
if (@_) {
sub version {
my $self = shift;
- ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })};
+ ${$self->get_or_add_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })};
}
sub authority {
my $self = shift;
- ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })};
+ ${$self->get_or_add_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })};
}
sub identifier {
$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(@_);
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
name
namespace
- add_package_symbol get_package_symbol has_package_symbol remove_package_symbol
+ add_package_symbol get_package_symbol has_package_symbol
+ remove_package_symbol get_or_add_package_symbol
list_all_package_symbols get_all_package_symbols remove_package_glob
_package_stash