X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FExporter.pm;h=0b4468ad10a366d9388f55218b8c0a41b02b7a12;hb=8aba926dbf11e9cf418c7c79b925d15e60e1e990;hp=d2bf45e83f1fb8b0df8b83f798d3e5d46580c801;hpb=6e168432fa69bbe87ff0dd12e355a8b5d99a1a9c;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Exporter.pm b/lib/Mouse/Exporter.pm index d2bf45e..0b4468a 100644 --- a/lib/Mouse/Exporter.pm +++ b/lib/Mouse/Exporter.pm @@ -149,7 +149,7 @@ sub do_import { my $arg = shift @args; if($arg =~ s/^-//){ if($arg eq 'traits'){ - push @traits, @{shift(@args)}; + push @traits, ref($args[0]) ? @{shift(@args)} : shift(@args); } else { Mouse::Util::not_supported("-$arg"); @@ -177,10 +177,11 @@ sub do_import { if(@traits){ my $type = (split /::/, ref $meta)[-1]; # e.g. "Class" for "My::Meta::Class" @traits = - map{ ref($_) ? $_ : Mouse::Util::resolve_metaclass_alias($type => $_, trait => 1) } - @traits; + map{ + ref($_) ? $_ + : Mouse::Util::resolve_metaclass_alias($type => $_, trait => 1) + } @traits; - not_supported('-traits'); require Mouse::Util::MetaRole; Mouse::Util::MetaRole::apply_metaclass_roles( for_class => $into, @@ -188,6 +189,9 @@ sub do_import { ); } } + elsif(@traits){ + Carp::confess("Cannot provide traits when $package does not have an init_meta() method"); + } if(@exports){ foreach my $keyword(@exports){ @@ -258,7 +262,7 @@ Mouse::Exporter - make an import() and unimport() just like Mouse.pm =head1 VERSION -This document describes Mouse version 0.40_05 +This document describes Mouse version 0.40_07 =head1 SYNOPSIS