confess "'parameter' may not be used inside of the role block"
if $CURRENT_METACLASS;
- my $meta = Class::MOP::Class->initialize($caller);
+ my $meta = Class::MOP::class_of($caller);
my $names = shift;
$names = [$names] if !ref($names);
sub role (&) {
my $caller = shift;
my $role_generator = shift;
- Class::MOP::Class->initialize($caller)->role_generator($role_generator);
+ Class::MOP::class_of($caller)->role_generator($role_generator);
}
sub init_meta {
sub has {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
my $names = shift;
$names = [$names] if !ref($names);
sub method {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
my $name = shift;
my $body = shift;
sub before {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
my $code = pop @_;
sub after {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
my $code = pop @_;
sub around {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
my $code = pop @_;
sub with {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
Moose::Util::apply_all_roles($meta, @_);
}
sub requires {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
Carp::croak "Must specify at least one method" unless @_;
$meta->add_required_methods(@_);
sub excludes {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
Carp::croak "Must specify at least one role" unless @_;
$meta->add_excluded_roles(@_);
sub override {
my $caller = shift;
- my $meta = $CURRENT_METACLASS || Class::MOP::Class->initialize($caller);
+ my $meta = $CURRENT_METACLASS || Class::MOP::class_of($caller);
my ($name, $code) = @_;
$meta->add_override_method_modifier($name, $code);