],
);
-# XXX: for backward compatibility
-our @EXPORT = qw(
- extends with
- has
- before after around
- override super
- augment inner
- blessed confess
-);
-sub extends { Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_) }
+sub extends {
+ Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_);
+ return;
+}
+
+sub with {
+ Mouse::Util::apply_all_roles(scalar(caller), @_);
+ return;
+}
sub has {
my $meta = Mouse::Meta::Class->initialize(scalar caller);
my $name = shift;
- $meta->throw_error(q{Usage: has 'name' => ( key => value, ... )})\r
+ $meta->throw_error(q{Usage: has 'name' => ( key => value, ... )})
if @_ % 2; # odd number of arguments
- $meta->add_attribute($_ => @_) for ref($name) ? @{$name} : $name;
+ if(ref $name){ # has [qw(foo bar)] => (...)
+ for (@{$name}){
+ $meta->add_attribute($_ => @_);
+ }
+ }
+ else{ # has foo => (...)
+ $meta->add_attribute($_ => @_);
+ }
+ return;
}
sub before {
for (@_) {
$meta->add_before_method_modifier($_ => $code);
}
+ return;
}
sub after {
for (@_) {
$meta->add_after_method_modifier($_ => $code);
}
+ return;
}
sub around {
for (@_) {
$meta->add_around_method_modifier($_ => $code);
}
-}
-
-sub with {
- Mouse::Util::apply_all_roles(scalar(caller), @_);
+ return;
}
our $SUPER_PACKAGE;
sub augment {
#my($name, $method) = @_;
Mouse::Meta::Class->initialize(scalar caller)->add_augment_method_modifier(@_);
+ return;
}
sub init_meta {
],
);
-# XXX: for backward compatibility
-our @EXPORT = qw(
- extends with
- has
- before after around
- override super
- augment inner
- requires excludes
+sub extends {
+ Carp::croak "Roles do not support 'extends'";
+}
- blessed confess
-);
+sub with {
+ my $meta = Mouse::Meta::Role->initialize(scalar caller);
+ Mouse::Util::apply_all_roles($meta->name, @_);
+ return;
+}
+
+sub has {
+ my $meta = Mouse::Meta::Role->initialize(scalar caller);
+ my $name = shift;
+
+ $meta->throw_error(q{Usage: has 'name' => ( key => value, ... )})
+ if @_ % 2; # odd number of arguments
+
+ if(ref $name){ # has [qw(foo bar)] => (...)
+ for (@{$name}){
+ $meta->add_attribute($_ => @_);
+ }
+ }
+ else{ # has foo => (...)
+ $meta->add_attribute($_ => @_);
+ }
+ return;
+}
sub before {
my $meta = Mouse::Meta::Role->initialize(scalar caller);
for (@_) {
$meta->add_before_method_modifier($_ => $code);
}
+ return;
}
sub after {
for (@_) {
$meta->add_after_method_modifier($_ => $code);
}
+ return;
}
sub around {
for (@_) {
$meta->add_around_method_modifier($_ => $code);
}
+ return;
}
sub override {
# my($name, $code) = @_;
Mouse::Meta::Role->initialize(scalar caller)->add_override_method_modifier(@_);
+ return;
}
# We keep the same errors messages as Moose::Role emits, here.
Carp::croak "Roles cannot support 'augment'";
}
-sub has {
- my $meta = Mouse::Meta::Role->initialize(scalar caller);
- my $name = shift;
-
- $meta->add_attribute($_ => @_) for ref($name) ? @{$name} : $name;
-}
-
-sub extends {
- Carp::croak "Roles do not support 'extends'"
-}
-
-sub with {
- my $meta = Mouse::Meta::Role->initialize(scalar caller);
- Mouse::Util::apply_all_roles($meta->name, @_);
-}
-
sub requires {
my $meta = Mouse::Meta::Role->initialize(scalar caller);
$meta->throw_error("Must specify at least one method") unless @_;
$meta->add_required_methods(@_);
+ return;
}
sub excludes {