## Class::MOP::Package
Class::MOP::Package->meta->add_attribute(
- Class::MOP::Attribute->new('$!package' => (
+ Class::MOP::Attribute->new('package' => (
reader => {
# NOTE: we need to do this in order
# for the instance meta-object to
);
Class::MOP::Package->meta->add_attribute(
- Class::MOP::Attribute->new('%!namespace' => (
+ Class::MOP::Attribute->new('namespace' => (
reader => {
# NOTE:
# we just alias the original method
# the metaclass, isn't abstraction great :)
Class::MOP::Module->meta->add_attribute(
- Class::MOP::Attribute->new('$!version' => (
+ Class::MOP::Attribute->new('version' => (
reader => {
# NOTE:
# we just alias the original method
# well.
Class::MOP::Module->meta->add_attribute(
- Class::MOP::Attribute->new('$!authority' => (
+ Class::MOP::Attribute->new('authority' => (
reader => {
# NOTE:
# we just alias the original method
## Class::MOP::Class
Class::MOP::Class->meta->add_attribute(
- Class::MOP::Attribute->new('%!attributes' => (
+ Class::MOP::Attribute->new('attributes' => (
reader => {
# NOTE: we need to do this in order
# for the instance meta-object to
);
Class::MOP::Class->meta->add_attribute(
- Class::MOP::Attribute->new('%!methods' => (
+ Class::MOP::Attribute->new('methods' => (
init_arg => 'methods',
reader => {
# NOTE:
);
Class::MOP::Class->meta->add_attribute(
- Class::MOP::Attribute->new('@!superclasses' => (
+ Class::MOP::Attribute->new('superclasses' => (
accessor => {
# NOTE:
# we just alias the original method
);
Class::MOP::Class->meta->add_attribute(
- Class::MOP::Attribute->new('$!attribute_metaclass' => (
+ Class::MOP::Attribute->new('attribute_metaclass' => (
reader => {
# NOTE:
# we just alias the original method
);
Class::MOP::Class->meta->add_attribute(
- Class::MOP::Attribute->new('$!method_metaclass' => (
+ Class::MOP::Attribute->new('method_metaclass' => (
reader => {
# NOTE:
# we just alias the original method
);
Class::MOP::Class->meta->add_attribute(
- Class::MOP::Attribute->new('$!instance_metaclass' => (
+ Class::MOP::Attribute->new('instance_metaclass' => (
reader => {
# NOTE: we need to do this in order
# for the instance meta-object to
## Class::MOP::Attribute
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!name' => (
+ Class::MOP::Attribute->new('name' => (
init_arg => 'name',
reader => {
# NOTE: we need to do this in order
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!associated_class' => (
+ Class::MOP::Attribute->new('associated_class' => (
init_arg => 'associated_class',
reader => {
# NOTE: we need to do this in order
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!accessor' => (
+ Class::MOP::Attribute->new('accessor' => (
init_arg => 'accessor',
reader => { 'accessor' => \&Class::MOP::Attribute::accessor },
predicate => { 'has_accessor' => \&Class::MOP::Attribute::has_accessor },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!reader' => (
+ Class::MOP::Attribute->new('reader' => (
init_arg => 'reader',
reader => { 'reader' => \&Class::MOP::Attribute::reader },
predicate => { 'has_reader' => \&Class::MOP::Attribute::has_reader },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!initializer' => (
+ Class::MOP::Attribute->new('initializer' => (
init_arg => 'initializer',
reader => { 'initializer' => \&Class::MOP::Attribute::initializer },
predicate => { 'has_initializer' => \&Class::MOP::Attribute::has_initializer },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!writer' => (
+ Class::MOP::Attribute->new('writer' => (
init_arg => 'writer',
reader => { 'writer' => \&Class::MOP::Attribute::writer },
predicate => { 'has_writer' => \&Class::MOP::Attribute::has_writer },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!predicate' => (
+ Class::MOP::Attribute->new('predicate' => (
init_arg => 'predicate',
reader => { 'predicate' => \&Class::MOP::Attribute::predicate },
predicate => { 'has_predicate' => \&Class::MOP::Attribute::has_predicate },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!clearer' => (
+ Class::MOP::Attribute->new('clearer' => (
init_arg => 'clearer',
reader => { 'clearer' => \&Class::MOP::Attribute::clearer },
predicate => { 'has_clearer' => \&Class::MOP::Attribute::has_clearer },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!builder' => (
+ Class::MOP::Attribute->new('builder' => (
init_arg => 'builder',
reader => { 'builder' => \&Class::MOP::Attribute::builder },
predicate => { 'has_builder' => \&Class::MOP::Attribute::has_builder },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!init_arg' => (
+ Class::MOP::Attribute->new('init_arg' => (
init_arg => 'init_arg',
reader => { 'init_arg' => \&Class::MOP::Attribute::init_arg },
predicate => { 'has_init_arg' => \&Class::MOP::Attribute::has_init_arg },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('$!default' => (
+ Class::MOP::Attribute->new('default' => (
init_arg => 'default',
# default has a custom 'reader' method ...
predicate => { 'has_default' => \&Class::MOP::Attribute::has_default },
);
Class::MOP::Attribute->meta->add_attribute(
- Class::MOP::Attribute->new('@!associated_methods' => (
+ Class::MOP::Attribute->new('associated_methods' => (
init_arg => 'associated_methods',
reader => { 'associated_methods' => \&Class::MOP::Attribute::associated_methods },
default => sub { [] }
"wrap the default of '$name' in a CODE reference (ex: sub { [] } and not [])")
if exists $options{default} && ref $options{default};
}
+
# return the new object
$class->meta->new_object(name => $name, %options);
});
## --------------------------------------------------------
## Class::MOP::Method
-
Class::MOP::Method->meta->add_attribute(
- Class::MOP::Attribute->new('&!body' => (
+ Class::MOP::Attribute->new('body' => (
init_arg => 'body',
reader => { 'body' => \&Class::MOP::Method::body },
))
);
Class::MOP::Method->meta->add_attribute(
- Class::MOP::Attribute->new('$!package_name' => (
+ Class::MOP::Attribute->new('package_name' => (
init_arg => 'package_name',
reader => { 'package_name' => \&Class::MOP::Method::package_name },
))
);
Class::MOP::Method->meta->add_attribute(
- Class::MOP::Attribute->new('$!name' => (
+ Class::MOP::Attribute->new('name' => (
init_arg => 'name',
reader => { 'name' => \&Class::MOP::Method::name },
))
# practices of attributes, but we put
# it here for completeness
Class::MOP::Method::Wrapped->meta->add_attribute(
- Class::MOP::Attribute->new('%!modifier_table')
+ Class::MOP::Attribute->new('modifier_table')
);
## --------------------------------------------------------
## Class::MOP::Method::Generated
Class::MOP::Method::Generated->meta->add_attribute(
- Class::MOP::Attribute->new('$!is_inline' => (
+ Class::MOP::Attribute->new('is_inline' => (
init_arg => 'is_inline',
reader => { 'is_inline' => \&Class::MOP::Method::Generated::is_inline },
default => 0,
## Class::MOP::Method::Accessor
Class::MOP::Method::Accessor->meta->add_attribute(
- Class::MOP::Attribute->new('$!attribute' => (
+ Class::MOP::Attribute->new('attribute' => (
init_arg => 'attribute',
reader => {
'associated_attribute' => \&Class::MOP::Method::Accessor::associated_attribute
);
Class::MOP::Method::Accessor->meta->add_attribute(
- Class::MOP::Attribute->new('$!accessor_type' => (
+ Class::MOP::Attribute->new('accessor_type' => (
init_arg => 'accessor_type',
reader => { 'accessor_type' => \&Class::MOP::Method::Accessor::accessor_type },
))
# we don't want this creating
# a cycle in the code, if not
# needed
- Scalar::Util::weaken($self->{'$!attribute'});
+ Scalar::Util::weaken($self->{'attribute'});
$self->initialize_body;
## Class::MOP::Method::Constructor
Class::MOP::Method::Constructor->meta->add_attribute(
- Class::MOP::Attribute->new('%!options' => (
+ Class::MOP::Attribute->new('options' => (
init_arg => 'options',
reader => {
'options' => \&Class::MOP::Method::Constructor::options
);
Class::MOP::Method::Constructor->meta->add_attribute(
- Class::MOP::Attribute->new('$!associated_metaclass' => (
+ Class::MOP::Attribute->new('associated_metaclass' => (
init_arg => 'metaclass',
reader => {
'associated_metaclass' => \&Class::MOP::Method::Constructor::associated_metaclass
# we don't want this creating
# a cycle in the code, if not
# needed
- Scalar::Util::weaken($self->{'$!associated_metaclass'});
+ Scalar::Util::weaken($self->{'associated_metaclass'});
$self->initialize_body;
# included for completeness
Class::MOP::Instance->meta->add_attribute(
- Class::MOP::Attribute->new('$!meta')
+ Class::MOP::Attribute->new('meta')
);
Class::MOP::Instance->meta->add_attribute(
- Class::MOP::Attribute->new('@!slots')
+ Class::MOP::Attribute->new('slots')
);
## --------------------------------------------------------
if( $options{required} and not( defined($options{builder}) || defined($options{init_arg}) || exists $options{default} ) ) {
confess("A required attribute must have either 'init_arg', 'builder', or 'default'");
}
+
bless {
- '$!name' => $name,
- '$!accessor' => $options{accessor},
- '$!reader' => $options{reader},
- '$!writer' => $options{writer},
- '$!predicate' => $options{predicate},
- '$!clearer' => $options{clearer},
- '$!builder' => $options{builder},
- '$!init_arg' => $options{init_arg},
- '$!default' => $options{default},
- '$!initializer' => $options{initializer},
+ 'name' => $name,
+ 'accessor' => $options{accessor},
+ 'reader' => $options{reader},
+ 'writer' => $options{writer},
+ 'predicate' => $options{predicate},
+ 'clearer' => $options{clearer},
+ 'builder' => $options{builder},
+ 'init_arg' => $options{init_arg},
+ 'default' => $options{default},
+ 'initializer' => $options{initializer},
# keep a weakened link to the
# class we are associated with
- '$!associated_class' => undef,
+ 'associated_class' => undef,
# and a list of the methods
# associated with this attr
- '@!associated_methods' => [],
- # NOTE:
- # protect this from silliness
- init_arg => undef,
+ 'associated_methods' => [],
} => $class;
}
sub initialize_instance_slot {
my ($self, $meta_instance, $instance, $params) = @_;
- my $init_arg = $self->{'$!init_arg'};
+ my $init_arg = $self->{'init_arg'};
+
# try to fetch the init arg from the %params ...
# if nothing was in the %params, we can use the
$params->{$init_arg},
);
}
- elsif (defined $self->{'$!default'}) {
+ elsif (defined $self->{'default'}) {
$self->_set_initial_slot_value(
$meta_instance,
$instance,
$self->default($instance),
);
}
- elsif (defined( my $builder = $self->{'$!builder'})) {
+ elsif (defined( my $builder = $self->{'builder'})) {
if ($builder = $instance->can($builder)) {
$self->_set_initial_slot_value(
$meta_instance,
);
}
else {
- confess(blessed($instance)." does not support builder method '". $self->{'$!builder'} ."' for attribute '" . $self->name . "'");
+ confess(blessed($instance)." does not support builder method '". $self->{'builder'} ."' for attribute '" . $self->name . "'");
}
}
}
# the next bunch of methods will get bootstrapped
# away in the Class::MOP bootstrapping section
-sub name { $_[0]->{'$!name'} }
-
-sub associated_class { $_[0]->{'$!associated_class'} }
-sub associated_methods { $_[0]->{'@!associated_methods'} }
-
-sub has_accessor { defined($_[0]->{'$!accessor'}) ? 1 : 0 }
-sub has_reader { defined($_[0]->{'$!reader'}) ? 1 : 0 }
-sub has_writer { defined($_[0]->{'$!writer'}) ? 1 : 0 }
-sub has_predicate { defined($_[0]->{'$!predicate'}) ? 1 : 0 }
-sub has_clearer { defined($_[0]->{'$!clearer'}) ? 1 : 0 }
-sub has_builder { defined($_[0]->{'$!builder'}) ? 1 : 0 }
-sub has_init_arg { defined($_[0]->{'$!init_arg'}) ? 1 : 0 }
-sub has_default { defined($_[0]->{'$!default'}) ? 1 : 0 }
-sub has_initializer { defined($_[0]->{'$!initializer'}) ? 1 : 0 }
-
-sub accessor { $_[0]->{'$!accessor'} }
-sub reader { $_[0]->{'$!reader'} }
-sub writer { $_[0]->{'$!writer'} }
-sub predicate { $_[0]->{'$!predicate'} }
-sub clearer { $_[0]->{'$!clearer'} }
-sub builder { $_[0]->{'$!builder'} }
-sub init_arg { $_[0]->{'$!init_arg'} }
-sub initializer { $_[0]->{'$!initializer'} }
+sub name { $_[0]->{'name'} }
+
+sub associated_class { $_[0]->{'associated_class'} }
+sub associated_methods { $_[0]->{'associated_methods'} }
+
+sub has_accessor { defined($_[0]->{'accessor'}) ? 1 : 0 }
+sub has_reader { defined($_[0]->{'reader'}) ? 1 : 0 }
+sub has_writer { defined($_[0]->{'writer'}) ? 1 : 0 }
+sub has_predicate { defined($_[0]->{'predicate'}) ? 1 : 0 }
+sub has_clearer { defined($_[0]->{'clearer'}) ? 1 : 0 }
+sub has_builder { defined($_[0]->{'builder'}) ? 1 : 0 }
+sub has_init_arg { defined($_[0]->{'init_arg'}) ? 1 : 0 }
+sub has_default { defined($_[0]->{'default'}) ? 1 : 0 }
+sub has_initializer { defined($_[0]->{'initializer'}) ? 1 : 0 }
+
+sub accessor { $_[0]->{'accessor'} }
+sub reader { $_[0]->{'reader'} }
+sub writer { $_[0]->{'writer'} }
+sub predicate { $_[0]->{'predicate'} }
+sub clearer { $_[0]->{'clearer'} }
+sub builder { $_[0]->{'builder'} }
+sub init_arg { $_[0]->{'init_arg'} }
+sub initializer { $_[0]->{'initializer'} }
# end bootstrapped away method section.
# (all methods below here are kept intact)
}
sub is_default_a_coderef {
- ('CODE' eq ref($_[0]->{'$!default'} || $_[0]->{default}))
+ ('CODE' eq ref($_[0]->{'default'} || $_[0]->{default}))
}
sub default {
# we pass in the instance and default
# can return a value based on that
# instance. Somewhat crude, but works.
- return $self->{'$!default'}->($instance);
+ return $self->{'default'}->($instance);
}
- $self->{'$!default'};
+ $self->{'default'};
}
# slots
my ($self, $class) = @_;
(blessed($class) && $class->isa('Class::MOP::Class'))
|| confess "You must pass a Class::MOP::Class instance (or a subclass)";
- weaken($self->{'$!associated_class'} = $class);
+ weaken($self->{'associated_class'} = $class);
}
sub detach_from_class {
my $self = shift;
- $self->{'$!associated_class'} = undef;
+ $self->{'associated_class'} = undef;
}
# method association
sub associate_method {
my ($self, $method) = @_;
- push @{$self->{'@!associated_methods'}} => $method;
+ push @{$self->{'associated_methods'}} => $method;
}
## Slot management
no strict 'refs';
$meta = bless {
# inherited from Class::MOP::Package
- '$!package' => $package_name,
+ 'package' => $package_name,
# NOTE:
# since the following attributes will
# listed here for reference, because they
# should not actually have a value associated
# with the slot.
- '%!namespace' => \undef,
+ 'namespace' => \undef,
# inherited from Class::MOP::Module
- '$!version' => \undef,
- '$!authority' => \undef,
+ 'version' => \undef,
+ 'authority' => \undef,
# defined in Class::MOP::Class
- '@!superclasses' => \undef,
+ 'superclasses' => \undef,
- '%!methods' => {},
- '%!attributes' => {},
- '$!attribute_metaclass' => $options{'attribute_metaclass'} || 'Class::MOP::Attribute',
- '$!method_metaclass' => $options{'method_metaclass'} || 'Class::MOP::Method',
- '$!instance_metaclass' => $options{'instance_metaclass'} || 'Class::MOP::Instance',
+ 'methods' => {},
+ 'attributes' => {},
+ 'attribute_metaclass' => $options{'attribute_metaclass'} || 'Class::MOP::Attribute',
+ 'method_metaclass' => $options{'method_metaclass'} || 'Class::MOP::Method',
+ 'instance_metaclass' => $options{'instance_metaclass'} || 'Class::MOP::Instance',
## uber-private variables
# NOTE:
# we can tell the first time the
# methods are fetched
# - SL
- '$!_package_cache_flag' => undef,
- '$!_meta_instance' => undef,
+ '_package_cache_flag' => undef,
+ '_meta_instance' => undef,
} => $class;
}
else {
$meta;
}
-sub reset_package_cache_flag { (shift)->{'$!_package_cache_flag'} = undef }
+sub reset_package_cache_flag { (shift)->{'_package_cache_flag'} = undef }
sub update_package_cache_flag {
my $self = shift;
# NOTE:
# to our cache as well. This avoids us
# having to regenerate the method_map.
# - SL
- $self->{'$!_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
+ $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
}
sub check_metaclass_compatability {
# all these attribute readers will be bootstrapped
# away in the Class::MOP bootstrap section
-sub get_attribute_map { $_[0]->{'%!attributes'} }
-sub attribute_metaclass { $_[0]->{'$!attribute_metaclass'} }
-sub method_metaclass { $_[0]->{'$!method_metaclass'} }
-sub instance_metaclass { $_[0]->{'$!instance_metaclass'} }
+sub get_attribute_map { $_[0]->{'attributes'} }
+sub attribute_metaclass { $_[0]->{'attribute_metaclass'} }
+sub method_metaclass { $_[0]->{'method_metaclass'} }
+sub instance_metaclass { $_[0]->{'instance_metaclass'} }
# FIXME:
# this is a prime canidate for conversion to XS
sub get_method_map {
my $self = shift;
- if (defined $self->{'$!_package_cache_flag'} &&
- $self->{'$!_package_cache_flag'} == Class::MOP::check_package_cache_flag($self->name)) {
- return $self->{'%!methods'};
+ if (defined $self->{'_package_cache_flag'} &&
+ $self->{'_package_cache_flag'} == Class::MOP::check_package_cache_flag($self->name)) {
+ return $self->{'methods'};
}
- my $map = $self->{'%!methods'};
+ my $map = $self->{'methods'};
my $class_name = $self->name;
my $method_metaclass = $self->method_metaclass;
sub new_object {
my $class = shift;
+
# NOTE:
# we need to protect the integrity of the
# Class::MOP::Class singletons here, so we
# is probably needed, but better safe
# then sorry.
# - SL
- $self->{'$!_meta_instance'} = undef
- if defined $self->{'$!_package_cache_flag'} &&
- $self->{'$!_package_cache_flag'} == Class::MOP::check_package_cache_flag($self->name);
- $self->{'$!_meta_instance'} ||= $self->instance_metaclass->new(
+ $self->{'_meta_instance'} = undef
+ if defined $self->{'_package_cache_flag'} &&
+ $self->{'_package_cache_flag'} == Class::MOP::check_package_cache_flag($self->name);
+ $self->{'_meta_instance'} ||= $self->instance_metaclass->new(
$self,
$self->compute_all_applicable_attributes()
);
my ($class, $metaclass, $options) = @_;
my $self = bless {
- '$!metaclass' => $metaclass,
- '%!options' => $options,
- '$!immutable_metaclass' => undef,
+ 'metaclass' => $metaclass,
+ 'options' => $options,
+ 'immutable_metaclass' => undef,
} => $class;
# NOTE:
return $self;
}
-sub immutable_metaclass { (shift)->{'$!immutable_metaclass'} }
-sub metaclass { (shift)->{'$!metaclass'} }
-sub options { (shift)->{'%!options'} }
+sub immutable_metaclass { (shift)->{'immutable_metaclass'} }
+sub metaclass { (shift)->{'metaclass'} }
+sub options { (shift)->{'options'} }
sub create_immutable_metaclass {
my $self = shift;
# metaclass is just a anon-class
# which shadows the methods
# appropriately
- $self->{'$!immutable_metaclass'} = Class::MOP::Class->create_anon_class(
+ $self->{'immutable_metaclass'} = Class::MOP::Class->create_anon_class(
superclasses => [ blessed($self->metaclass) ],
methods => $self->create_methods_for_immutable_metaclass,
);
# which is *probably* a safe
# assumption,.. but you can
# never tell <:)
- '$!meta' => $meta,
- '@!slots' => { map { $_ => undef } @slots },
+ 'meta' => $meta,
+ 'slots' => { map { $_ => undef } @slots },
} => $class;
- weaken($instance->{'$!meta'});
+ weaken($instance->{'meta'});
return $instance;
}
-sub associated_metaclass { (shift)->{'$!meta'} }
+sub associated_metaclass { (shift)->{'meta'} }
sub create_instance {
my $self = shift;
sub get_all_slots {
my $self = shift;
- return keys %{$self->{'@!slots'}};
+ return keys %{$self->{'slots'}};
}
sub is_valid_slot {
my ($self, $slot_name) = @_;
- exists $self->{'@!slots'}->{$slot_name};
+ exists $self->{'slots'}->{$slot_name};
}
# operations on created instances
|| confess "You must supply the package_name and name parameters $UPGRADE_ERROR_TEXT";
bless {
- '&!body' => $code,
- '$!package_name' => $params{package_name},
- '$!name' => $params{name},
+ 'body' => $code,
+ 'package_name' => $params{package_name},
+ 'name' => $params{name},
} => blessed($class) || $class;
}
## accessors
-sub body { (shift)->{'&!body'} }
+sub body { (shift)->{'body'} }
# TODO - add associated_class
sub package_name {
my $self = shift;
- $self->{'$!package_name'} ||= (Class::MOP::get_code_info($self->body))[0];
+ $self->{'package_name'} ||= (Class::MOP::get_code_info($self->body))[0];
}
sub name {
my $self = shift;
- $self->{'$!name'} ||= (Class::MOP::get_code_info($self->body))[1];
+ $self->{'name'} ||= (Class::MOP::get_code_info($self->body))[1];
}
sub fully_qualified_name {
my $self = bless {
# from our superclass
- '&!body' => undef,
- '$!package_name' => $options{package_name},
- '$!name' => $options{name},
+ 'body' => undef,
+ 'package_name' => $options{package_name},
+ 'name' => $options{name},
# specific to this subclass
- '$!attribute' => $options{attribute},
- '$!is_inline' => ($options{is_inline} || 0),
- '$!accessor_type' => $options{accessor_type},
+ 'attribute' => $options{attribute},
+ 'is_inline' => ($options{is_inline} || 0),
+ 'accessor_type' => $options{accessor_type},
} => $class;
# we don't want this creating
# a cycle in the code, if not
# needed
- weaken($self->{'$!attribute'});
+ weaken($self->{'attribute'});
$self->initialize_body;
## accessors
-sub associated_attribute { (shift)->{'$!attribute'} }
-sub accessor_type { (shift)->{'$!accessor_type'} }
+sub associated_attribute { (shift)->{'attribute'} }
+sub accessor_type { (shift)->{'accessor_type'} }
## factory
($self->is_inline ? 'inline' : ())
);
- eval { $self->{'&!body'} = $self->$method_name() };
+ eval { $self->{'body'} = $self->$method_name() };
die $@ if $@;
}
my $self = bless {
# from our superclass
- '&!body' => undef,
- '$!package_name' => $options{package_name},
- '$!name' => $options{name},
+ 'body' => undef,
+ 'package_name' => $options{package_name},
+ 'name' => $options{name},
# specific to this subclass
- '%!options' => $options{options} || {},
- '$!associated_metaclass' => $options{metaclass},
- '$!is_inline' => ($options{is_inline} || 0),
+ 'options' => $options{options} || {},
+ 'associated_metaclass' => $options{metaclass},
+ 'is_inline' => ($options{is_inline} || 0),
} => $class;
# we don't want this creating
# a cycle in the code, if not
# needed
- weaken($self->{'$!associated_metaclass'});
+ weaken($self->{'associated_metaclass'});
$self->initialize_body;
## accessors
-sub options { (shift)->{'%!options'} }
-sub associated_metaclass { (shift)->{'$!associated_metaclass'} }
+sub options { (shift)->{'options'} }
+sub associated_metaclass { (shift)->{'associated_metaclass'} }
## cached values ...
sub meta_instance {
my $self = shift;
- $self->{'$!meta_instance'} ||= $self->associated_metaclass->get_meta_instance;
+ $self->{'meta_instance'} ||= $self->associated_metaclass->get_meta_instance;
}
sub attributes {
my $self = shift;
- $self->{'@!attributes'} ||= [ $self->associated_metaclass->compute_all_applicable_attributes ]
+ $self->{'attributes'} ||= [ $self->associated_metaclass->compute_all_applicable_attributes ]
}
## method
$method_name .= '_inline' if $self->is_inline;
- $self->{'&!body'} = $self->$method_name;
+ $self->{'body'} = $self->$method_name;
}
sub generate_constructor_method {
my $self = bless {
# from our superclass
- '&!body' => undef,
- '$!package_name' => $options{package_name},
- '$!name' => $options{name},
+ 'body' => undef,
+ 'package_name' => $options{package_name},
+ 'name' => $options{name},
# specific to this subclass
- '$!is_inline' => ($options{is_inline} || 0),
+ 'is_inline' => ($options{is_inline} || 0),
} => $class;
$self->initialize_body;
## accessors
-sub is_inline { (shift)->{'$!is_inline'} }
+sub is_inline { (shift)->{'is_inline'} }
sub initialize_body {
confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
package_name => $params{package_name} || $code->package_name,
name => $params{name} || $code->name,
);
- $method->{'%!modifier_table'} = $modifier_table;
+ $method->{'modifier_table'} = $modifier_table;
$method;
}
sub get_original_method {
my $code = shift;
- $code->{'%!modifier_table'}->{orig};
+ $code->{'modifier_table'}->{orig};
}
sub add_before_modifier {
my $code = shift;
my $modifier = shift;
- unshift @{$code->{'%!modifier_table'}->{before}} => $modifier;
- $_build_wrapped_method->($code->{'%!modifier_table'});
+ unshift @{$code->{'modifier_table'}->{before}} => $modifier;
+ $_build_wrapped_method->($code->{'modifier_table'});
}
sub add_after_modifier {
my $code = shift;
my $modifier = shift;
- push @{$code->{'%!modifier_table'}->{after}} => $modifier;
- $_build_wrapped_method->($code->{'%!modifier_table'});
+ push @{$code->{'modifier_table'}->{after}} => $modifier;
+ $_build_wrapped_method->($code->{'modifier_table'});
}
{
sub add_around_modifier {
my $code = shift;
my $modifier = shift;
- unshift @{$code->{'%!modifier_table'}->{around}->{methods}} => $modifier;
- $code->{'%!modifier_table'}->{around}->{cache} = $compile_around_method->(
- @{$code->{'%!modifier_table'}->{around}->{methods}},
- $code->{'%!modifier_table'}->{orig}->body
+ unshift @{$code->{'modifier_table'}->{around}->{methods}} => $modifier;
+ $code->{'modifier_table'}->{around}->{cache} = $compile_around_method->(
+ @{$code->{'modifier_table'}->{around}->{methods}},
+ $code->{'modifier_table'}->{orig}->body
);
- $_build_wrapped_method->($code->{'%!modifier_table'});
+ $_build_wrapped_method->($code->{'modifier_table'});
}
}
# until we can bootstrap it
no strict 'refs';
return bless {
- '$!package' => $package_name,
+ 'package' => $package_name,
# NOTE:
# because of issues with the Perl API
# to the typeglob in some versions, we
# reference to the hash in the accessor.
# Ideally we could just store a ref and
# it would Just Work, but oh well :\
- '%!namespace' => \undef,
+ 'namespace' => \undef,
} => $class;
}
# all these attribute readers will be bootstrapped
# away in the Class::MOP bootstrap section
-sub name { $_[0]->{'$!package'} }
+sub name { $_[0]->{'package'} }
sub namespace {
# NOTE:
# because of issues with the Perl API
# we could just store a ref and it would
# Just Work, but oh well :\
no strict 'refs';
- \%{$_[0]->{'$!package'} . '::'}
+ \%{$_[0]->{'package'} . '::'}
}
# utility methods
? @{$variable}{qw[name sigil type]}
: $self->_deconstruct_variable_name($variable);
- my $pkg = $self->{'$!package'};
+ my $pkg = $self->{'package'};
no strict 'refs';
no warnings 'redefine', 'misc';
# check for the right attributes
my @class_mop_package_attributes = (
- '$!package',
- '%!namespace',
+ 'package',
+ 'namespace',
);
my @class_mop_module_attributes = (
- '$!version',
- '$!authority'
+ 'version',
+ 'authority'
);
my @class_mop_class_attributes = (
- '@!superclasses',
- '%!methods',
- '%!attributes',
- '$!attribute_metaclass',
- '$!method_metaclass',
- '$!instance_metaclass'
+ 'superclasses',
+ 'methods',
+ 'attributes',
+ 'attribute_metaclass',
+ 'method_metaclass',
+ 'instance_metaclass'
);
# check class
# ... package
-ok($class_mop_package_meta->get_attribute('$!package')->has_reader, '... Class::MOP::Class $!package has a reader');
-is(ref($class_mop_package_meta->get_attribute('$!package')->reader), 'HASH', '... Class::MOP::Class $!package\'s a reader is { name => sub { ... } }');
+ok($class_mop_package_meta->get_attribute('package')->has_reader, '... Class::MOP::Class package has a reader');
+is(ref($class_mop_package_meta->get_attribute('package')->reader), 'HASH', '... Class::MOP::Class package\'s a reader is { name => sub { ... } }');
-ok($class_mop_package_meta->get_attribute('$!package')->has_init_arg, '... Class::MOP::Class $!package has a init_arg');
-is($class_mop_package_meta->get_attribute('$!package')->init_arg, 'package', '... Class::MOP::Class $!package\'s a init_arg is package');
+ok($class_mop_package_meta->get_attribute('package')->has_init_arg, '... Class::MOP::Class package has a init_arg');
+is($class_mop_package_meta->get_attribute('package')->init_arg, 'package', '... Class::MOP::Class package\'s a init_arg is package');
# ... class
-ok($class_mop_class_meta->get_attribute('%!attributes')->has_reader, '... Class::MOP::Class %!attributes has a reader');
-is_deeply($class_mop_class_meta->get_attribute('%!attributes')->reader,
+ok($class_mop_class_meta->get_attribute('attributes')->has_reader, '... Class::MOP::Class attributes has a reader');
+is_deeply($class_mop_class_meta->get_attribute('attributes')->reader,
{ 'get_attribute_map' => \&Class::MOP::Class::get_attribute_map },
- '... Class::MOP::Class %!attributes\'s a reader is &get_attribute_map');
+ '... Class::MOP::Class attributes\'s a reader is &get_attribute_map');
-ok($class_mop_class_meta->get_attribute('%!attributes')->has_init_arg, '... Class::MOP::Class %!attributes has a init_arg');
-is($class_mop_class_meta->get_attribute('%!attributes')->init_arg,
+ok($class_mop_class_meta->get_attribute('attributes')->has_init_arg, '... Class::MOP::Class attributes has a init_arg');
+is($class_mop_class_meta->get_attribute('attributes')->init_arg,
'attributes',
- '... Class::MOP::Class %!attributes\'s a init_arg is attributes');
+ '... Class::MOP::Class attributes\'s a init_arg is attributes');
-ok($class_mop_class_meta->get_attribute('%!attributes')->has_default, '... Class::MOP::Class %!attributes has a default');
-is_deeply($class_mop_class_meta->get_attribute('%!attributes')->default('Foo'),
+ok($class_mop_class_meta->get_attribute('attributes')->has_default, '... Class::MOP::Class attributes has a default');
+is_deeply($class_mop_class_meta->get_attribute('attributes')->default('Foo'),
{},
- '... Class::MOP::Class %!attributes\'s a default of {}');
+ '... Class::MOP::Class attributes\'s a default of {}');
-ok($class_mop_class_meta->get_attribute('$!attribute_metaclass')->has_reader, '... Class::MOP::Class $!attribute_metaclass has a reader');
-is_deeply($class_mop_class_meta->get_attribute('$!attribute_metaclass')->reader,
+ok($class_mop_class_meta->get_attribute('attribute_metaclass')->has_reader, '... Class::MOP::Class attribute_metaclass has a reader');
+is_deeply($class_mop_class_meta->get_attribute('attribute_metaclass')->reader,
{ 'attribute_metaclass' => \&Class::MOP::Class::attribute_metaclass },
- '... Class::MOP::Class $!attribute_metaclass\'s a reader is &attribute_metaclass');
+ '... Class::MOP::Class attribute_metaclass\'s a reader is &attribute_metaclass');
-ok($class_mop_class_meta->get_attribute('$!attribute_metaclass')->has_init_arg, '... Class::MOP::Class $!attribute_metaclass has a init_arg');
-is($class_mop_class_meta->get_attribute('$!attribute_metaclass')->init_arg,
+ok($class_mop_class_meta->get_attribute('attribute_metaclass')->has_init_arg, '... Class::MOP::Class attribute_metaclass has a init_arg');
+is($class_mop_class_meta->get_attribute('attribute_metaclass')->init_arg,
'attribute_metaclass',
- '... Class::MOP::Class $!attribute_metaclass\'s a init_arg is attribute_metaclass');
+ '... Class::MOP::Class attribute_metaclass\'s a init_arg is attribute_metaclass');
-ok($class_mop_class_meta->get_attribute('$!attribute_metaclass')->has_default, '... Class::MOP::Class $!attribute_metaclass has a default');
-is($class_mop_class_meta->get_attribute('$!attribute_metaclass')->default,
+ok($class_mop_class_meta->get_attribute('attribute_metaclass')->has_default, '... Class::MOP::Class attribute_metaclass has a default');
+is($class_mop_class_meta->get_attribute('attribute_metaclass')->default,
'Class::MOP::Attribute',
- '... Class::MOP::Class $!attribute_metaclass\'s a default is Class::MOP:::Attribute');
+ '... Class::MOP::Class attribute_metaclass\'s a default is Class::MOP:::Attribute');
-ok($class_mop_class_meta->get_attribute('$!method_metaclass')->has_reader, '... Class::MOP::Class $!method_metaclass has a reader');
-is_deeply($class_mop_class_meta->get_attribute('$!method_metaclass')->reader,
+ok($class_mop_class_meta->get_attribute('method_metaclass')->has_reader, '... Class::MOP::Class method_metaclass has a reader');
+is_deeply($class_mop_class_meta->get_attribute('method_metaclass')->reader,
{ 'method_metaclass' => \&Class::MOP::Class::method_metaclass },
- '... Class::MOP::Class $!method_metaclass\'s a reader is &method_metaclass');
+ '... Class::MOP::Class method_metaclass\'s a reader is &method_metaclass');
-ok($class_mop_class_meta->get_attribute('$!method_metaclass')->has_init_arg, '... Class::MOP::Class $!method_metaclass has a init_arg');
-is($class_mop_class_meta->get_attribute('$!method_metaclass')->init_arg,
+ok($class_mop_class_meta->get_attribute('method_metaclass')->has_init_arg, '... Class::MOP::Class method_metaclass has a init_arg');
+is($class_mop_class_meta->get_attribute('method_metaclass')->init_arg,
'method_metaclass',
'... Class::MOP::Class $:method_metaclass\'s init_arg is method_metaclass');
-ok($class_mop_class_meta->get_attribute('$!method_metaclass')->has_default, '... Class::MOP::Class $!method_metaclass has a default');
-is($class_mop_class_meta->get_attribute('$!method_metaclass')->default,
+ok($class_mop_class_meta->get_attribute('method_metaclass')->has_default, '... Class::MOP::Class method_metaclass has a default');
+is($class_mop_class_meta->get_attribute('method_metaclass')->default,
'Class::MOP::Method',
- '... Class::MOP::Class $!method_metaclass\'s a default is Class::MOP:::Method');
+ '... Class::MOP::Class method_metaclass\'s a default is Class::MOP:::Method');
# check the values of some of the methods
}
my @attributes = (
- '$!name',
- '$!accessor',
- '$!reader',
- '$!writer',
- '$!predicate',
- '$!clearer',
- '$!builder',
- '$!init_arg',
- '$!initializer',
- '$!default',
- '$!associated_class',
- '@!associated_methods',
+ 'name',
+ 'accessor',
+ 'reader',
+ 'writer',
+ 'predicate',
+ 'clearer',
+ 'builder',
+ 'init_arg',
+ 'initializer',
+ 'default',
+ 'associated_class',
+ 'associated_methods',
);
is_deeply(