From: gfx Date: Mon, 21 Sep 2009 06:23:13 +0000 (+0900) Subject: Use scalar(caller) instead of caller in list context X-Git-Tag: 0.32~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8bc2760b16d8ad03dedb54b8d2c6a2b4e6eaad2e;p=gitmo%2FMouse.git Use scalar(caller) instead of caller in list context --- diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 4f6e8f9..112f808 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -22,15 +22,15 @@ our %is_removable = map{ $_ => undef } @EXPORT; delete $is_removable{blessed}; delete $is_removable{confess}; -sub extends { Mouse::Meta::Class->initialize(caller)->superclasses(@_) } +sub extends { Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_) } sub has { - my $meta = Mouse::Meta::Class->initialize(caller); + my $meta = Mouse::Meta::Class->initialize(scalar caller); $meta->add_attribute(@_); } sub before { - my $meta = Mouse::Meta::Class->initialize(caller); + my $meta = Mouse::Meta::Class->initialize(scalar caller); my $code = pop; @@ -40,7 +40,7 @@ sub before { } sub after { - my $meta = Mouse::Meta::Class->initialize(caller); + my $meta = Mouse::Meta::Class->initialize(scalar caller); my $code = pop; @@ -50,7 +50,7 @@ sub after { } sub around { - my $meta = Mouse::Meta::Class->initialize(caller); + my $meta = Mouse::Meta::Class->initialize(scalar caller); my $code = pop; @@ -60,7 +60,7 @@ sub around { } sub with { - Mouse::Util::apply_all_roles((caller)[0], @_); + Mouse::Util::apply_all_roles(scalar(caller), @_); } our $SUPER_PACKAGE; diff --git a/lib/Mouse/Role.pm b/lib/Mouse/Role.pm index 4d27fd8..56cde3a 100644 --- a/lib/Mouse/Role.pm +++ b/lib/Mouse/Role.pm @@ -15,7 +15,7 @@ delete $is_removable{confess}; delete $is_removable{blessed}; sub before { - my $meta = Mouse::Meta::Role->initialize(caller); + my $meta = Mouse::Meta::Role->initialize(scalar caller); my $code = pop; for (@_) { @@ -24,7 +24,7 @@ sub before { } sub after { - my $meta = Mouse::Meta::Role->initialize(caller); + my $meta = Mouse::Meta::Role->initialize(scalar caller); my $code = pop; for (@_) { @@ -33,7 +33,7 @@ sub after { } sub around { - my $meta = Mouse::Meta::Role->initialize(caller); + my $meta = Mouse::Meta::Role->initialize(scalar caller); my $code = pop; for (@_) { @@ -78,7 +78,7 @@ sub augment { } sub has { - my $meta = Mouse::Meta::Role->initialize(caller); + my $meta = Mouse::Meta::Role->initialize(scalar caller); my $name = shift; my %opts = @_; @@ -89,7 +89,7 @@ sub has { sub extends { confess "Roles do not currently support 'extends'" } sub with { - my $meta = Mouse::Meta::Role->initialize(caller); + my $meta = Mouse::Meta::Role->initialize(scalar caller); my $role = shift; my $args = shift || {}; confess "Mouse::Role only supports 'with' on individual roles at a time" if @_ || !ref $args; @@ -99,7 +99,7 @@ sub with { } sub requires { - my $meta = Mouse::Meta::Role->initialize(caller); + my $meta = Mouse::Meta::Role->initialize(scalar caller); Carp::croak "Must specify at least one method" unless @_; $meta->add_required_methods(@_); }