From: Tokuhiro Matsuno Date: Wed, 3 Dec 2008 08:30:17 +0000 (+0000) Subject: Exporter::Heavy is too heavy.And, this is enough in a lot of case . X-Git-Tag: 0.19~136^2~50 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e15d73d2969213b7c24ee8d01518746a7da40860;p=gitmo%2FMouse.git Exporter::Heavy is too heavy.And, this is enough in a lot of case . --- diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 708b0a5..e1b0187 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -101,6 +101,8 @@ sub with { } sub import { + my $class = shift; + strict->import; warnings->import; @@ -114,7 +116,15 @@ sub import { no warnings 'redefine'; *{$caller.'::meta'} = sub { $meta }; - __PACKAGE__->export_to_level( 1, @_); + if (@_) { + __PACKAGE__->export_to_level( 1, $class, @_); + } else { + # shortcut for the common case of no type character + no strict 'refs'; + for my $keyword (@EXPORT) { + *{ $caller . '::' . $keyword } = *{__PACKAGE__ . '::' . $keyword}; + } + } } sub unimport {