From: Chris Prather Date: Thu, 11 Oct 2007 09:17:35 +0000 (+0000) Subject: add unimport into X-Git-Tag: 0_27~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca3f34c1354cb86de5a669d70c41d689d25a20ca;p=gitmo%2FMoose.git add unimport into --- diff --git a/lib/Moose.pm b/lib/Moose.pm index 3491d2e..02e4c3c 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -203,12 +203,16 @@ use Moose::Util::TypeConstraints; } ); - sub import { - $CALLER = - ref $_[1] && defined $_[1]->{into} ? $_[1]->{into} + sub get_caller{ + return ref $_[1] && defined $_[1]->{into} ? $_[1]->{into} : ref $_[1] && defined $_[1]->{into_level} ? caller( $_[1]->{into_level} ) : caller(); + } + + sub import { + $CALLER = get_caller(@_); + strict->import; warnings->import; @@ -222,7 +226,7 @@ use Moose::Util::TypeConstraints; sub unimport { no strict 'refs'; - my $class = caller(); + my $class = get_caller(@_); # loop through the exports ... foreach my $name ( keys %exports ) {