return $class;
}
-sub check_metaclass_compatibility {
+sub _check_metaclass_compatibility {
my $self = shift;
if ( my @supers = $self->superclasses ) {
$self->_fix_metaclass_incompatibility(@supers);
}
- $self->SUPER::check_metaclass_compatibility(@_);
+ $self->SUPER::_check_metaclass_compatibility(@_);
}
my %ANON_CLASSES;
or $self->throw_error("Could not create writer for '${\$self->associated_attribute->name}' because $@ \n code: $code", error => $@, data => $code );
}
-sub generate_accessor_method_inline {
+sub _generate_accessor_method_inline {
my $self = $_[0];
my $attr = $self->associated_attribute;
my $attr_name = $attr->name;
. ' }');
}
-sub generate_writer_method_inline {
+sub _generate_writer_method_inline {
my $self = $_[0];
my $attr = $self->associated_attribute;
my $attr_name = $attr->name;
. ' }');
}
-sub generate_reader_method_inline {
+sub _generate_reader_method_inline {
my $self = $_[0];
my $attr = $self->associated_attribute;
my $attr_name = $attr->name;
return $attr->should_coerce;
}
-sub generate_reader_method { shift->generate_reader_method_inline(@_) }
-sub generate_writer_method { shift->generate_writer_method_inline(@_) }
-sub generate_accessor_method { shift->generate_accessor_method_inline(@_) }
-sub generate_predicate_method { shift->generate_predicate_method_inline(@_) }
-sub generate_clearer_method { shift->generate_clearer_method_inline(@_) }
+sub _generate_reader_method { shift->_generate_reader_method_inline(@_) }
+sub _generate_writer_method { shift->_generate_writer_method_inline(@_) }
+sub _generate_accessor_method { shift->_generate_accessor_method_inline(@_) }
+sub _generate_predicate_method { shift->_generate_predicate_method_inline(@_) }
+sub _generate_clearer_method { shift->_generate_clearer_method_inline(@_) }
sub _inline_pre_body { '' }
sub _inline_post_body { '' }
|| confess "You must pass a HASH ref of methods"
if exists $options{methods};
- $role->SUPER::create(%options);
-
my (%initialize_options) = %options;
delete @initialize_options{qw(
package
my $meta = $role->initialize( $package_name => %initialize_options );
+ $meta->_instantiate_module( $options{version}, $options{authority} );
+
# FIXME totally lame
$meta->add_method('meta' => sub {
$role->initialize(ref($_[0]) || $_[0]);
$db->{$class}->[($oid - 1)] = {};
- $self->bless_instance_structure({
+ bless {
oid => $oid,
instance => $db->{$class}->[($oid - 1)]
- });
+ }, $class;
}
sub find_instance {
my ($self, $oid) = @_;
my $instance = $db->{$self->associated_metaclass->name}->[($oid - 1)];
- $self->bless_instance_structure({
+
+ bless {
oid => $oid,
- instance => $instance
- });
+ instance => $instance,
+ }, $self->associated_metaclass->name;
}
sub clone_instance {
my $clone = tied($instance)->clone;
- $self->bless_instance_structure({
+ bless {
oid => $oid,
- instance => $clone
- });
+ instance => $clone,
+ }, $class;
}
}
return $instance;
}
- sub generate_accessor_method {
+ sub _generate_accessor_method {
my $self = shift;
my $attr = $self->associated_attribute;
return sub {
};
}
- sub generate_reader_method {
+ sub _generate_reader_method {
my $self = shift;
my $attr = $self->associated_attribute;
return sub {
};
}
- sub generate_writer_method {
+ sub _generate_writer_method {
my $self = shift;
my $attr = $self->associated_attribute;
return sub {