From: Chris Prather Date: Sun, 16 Sep 2007 13:48:34 +0000 (+0000) Subject: add Sub::Exporter style caller() discovery X-Git-Tag: 0_26~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fc9a40d786825a3101a0a50582a76cf8e2ffb75a;p=gitmo%2FMoose.git add Sub::Exporter style caller() discovery --- diff --git a/lib/Moose/Role.pm b/lib/Moose/Role.pm index 2e6b187..55c283d 100644 --- a/lib/Moose/Role.pm +++ b/lib/Moose/Role.pm @@ -159,7 +159,12 @@ use Moose::Util::TypeConstraints; }); sub import { - $CALLER = caller(); + $CALLER = + ref $_[1] && defined $_[1]->{into} ? $_[1]->{into} + : ref $_[1] + && defined $_[1]->{into_level} ? caller( $_[1]->{into_level} ) + : caller(); + strict->import; warnings->import;