From: Stevan Little Date: Fri, 6 Jun 2008 19:15:57 +0000 (+0000) Subject: adding stuff for MX::Literals X-Git-Tag: 0_55~124 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c01baab6bb46344554711fa2553dd1410481ac5f;p=gitmo%2FMoose.git adding stuff for MX::Literals --- diff --git a/lib/Moose.pm b/lib/Moose.pm index 332593a..1039ed3 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -188,11 +188,11 @@ use Moose::Util (); sub _get_caller{ my $offset = 1; return - ref $_[1] && defined $_[1]->{into} - ? $_[1]->{into} - : ref $_[1] && defined $_[1]->{into_level} - ? caller($offset + $_[1]->{into_level}) - : caller($offset); + (ref $_[1] && defined $_[1]->{into}) + ? $_[1]->{into} + : (ref $_[1] && defined $_[1]->{into_level}) + ? caller($offset + $_[1]->{into_level}) + : caller($offset); } sub import { @@ -213,6 +213,21 @@ use Moose::Util (); goto $exporter; } + + # NOTE: + # This is for special use by + # some modules and stuff, I + # dont know if it is sane enough + # to document actually. + # - SL + sub __CURRY_EXPORTS_FOR_CLASS__ { + $CALLER = shift; + ($CALLER ne 'Moose') + || croak "_import_into must be called a function, not a method"; + ($CALLER->can('meta') && $CALLER->meta->isa('Class::MOP::Class')) + || croak "Cannot call _import_into on a package ($CALLER) without a metaclass"; + return map { $_ => $exports{$_}->() } (@_ ? @_ : keys %exports); + } sub unimport { no strict 'refs';