From: gfx Date: Wed, 7 Oct 2009 03:14:59 +0000 (+0900) Subject: s/group/groups/ X-Git-Tag: 0.37_03~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1bd3c83e1c553b1df2dcb2f366a9027ca9a2de7e;p=gitmo%2FMouse.git s/group/groups/ --- diff --git a/lib/Mouse/Exporter.pm b/lib/Mouse/Exporter.pm index 5884c68..d90fbe3 100644 --- a/lib/Mouse/Exporter.pm +++ b/lib/Mouse/Exporter.pm @@ -4,12 +4,19 @@ use warnings; use Carp qw(confess); -use Mouse::Util qw(get_code_info not_supported); +# it must be "require", because Mouse::Util depends on Mouse::Exporter +require Mouse::Util; my %SPEC; my $strict_bits = strict::bits(qw(subs refs vars)); +sub import{ + $^H |= $strict_bits; # strict->import; + ${^WARNING_BITS} = $warnings::Bits{all}; # warnings->import; + return; +} + sub setup_import_methods{ my($class, %args) = @_; @@ -50,7 +57,7 @@ sub setup_import_methods{ if(ref($thingy)){ $code = $thingy; - ($code_package, $code_name) = get_code_info($code); + ($code_package, $code_name) = Mouse::Util::get_code_info($code); } else{ no strict 'refs'; @@ -76,9 +83,9 @@ sub setup_import_methods{ $args{EXPORTS} = \%exports; $args{REMOVABLES} = \@removables; - $args{group}{all} ||= \@all; + $args{groups}{all} ||= \@all; - if(my $default_list = $args{group}{default}){ + if(my $default_list = $args{groups}{default}){ my %default; foreach my $keyword(@{$default_list}){ $default{$keyword} = $exports{$keyword} @@ -87,8 +94,8 @@ sub setup_import_methods{ $args{DEFAULT} = \%default; } else{ - $args{group}{default} ||= \@all; - $args{DEFAULT} = $args{EXPORTS}; + $args{groups}{default} ||= \@all; + $args{DEFAULT} = $args{EXPORTS}; } if(@init_meta_methods){ @@ -117,10 +124,10 @@ sub do_import { my @exports; foreach my $arg(@args){ if($arg =~ s/^-//){ - not_supported "-$arg"; + Mouse::Util::not_supported("-$arg"); } elsif($arg =~ s/^://){ - my $group = $spec->{group}{$arg} + my $group = $spec->{groups}{$arg} || confess(qq{The $package package does not export the group "$arg"}); push @exports, @{$group}; }