X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FExporter.pm;h=38e2beaa5f5b8f1f3c95314a4985cf58de534270;hb=26f0aa174f72fdf5fd803278212b7cefa83c8734;hp=3cbd81e8fb492ecb660c13c3e7ea9b517d63bdd4;hpb=e57a5068a04271a23b54f834ddec60e82b76275e;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Exporter.pm b/lib/Mouse/Exporter.pm index 3cbd81e..38e2bea 100644 --- a/lib/Mouse/Exporter.pm +++ b/lib/Mouse/Exporter.pm @@ -2,20 +2,26 @@ package Mouse::Exporter; use strict; use warnings; -use Carp qw(confess); +use Carp (); my %SPEC; my $strict_bits; BEGIN{ $strict_bits = strict::bits(qw(subs refs vars)); } +my $warnings_extra_bits; +BEGIN{ $warnings_extra_bits = warnings::bits(FATAL => 'recursion') } + # it must be "require", because Mouse::Util depends on Mouse::Exporter, # which depends on Mouse::Util::import() require Mouse::Util; sub import{ - $^H |= $strict_bits; # strict->import; - ${^WARNING_BITS} |= $warnings::Bits{all}; # warnings->import; + # strict->import; + $^H |= $strict_bits; + # warnings->import('all', FATAL => 'recursion'); + ${^WARNING_BITS} |= $warnings::Bits{all}; + ${^WARNING_BITS} |= $warnings_extra_bits; return; } @@ -33,15 +39,10 @@ sub setup_import_methods{ export_to_level => sub { my($package, $level, undef, @args) = @_; # the third argument is redundant - - Carp::carp("$package->export_to_level has been deprecated." - ." Use $package->import({ into_level => LEVEL }) instead"); $package->import({ into_level => $level + 1 }, @args); }, export => sub { my($package, $into, @args) = @_; - Carp::carp("$package->export has been deprecated." - ." Use $package->import({ into => PACKAGE }) instead"); $package->import({ into => $into }, @args); }, ); @@ -49,7 +50,7 @@ sub setup_import_methods{ } sub build_import_methods{ - my($class, %args) = @_; + my($self, %args) = @_; my $exporting_package = $args{exporting_package} ||= caller(); @@ -119,7 +120,7 @@ sub build_import_methods{ my %default; foreach my $keyword(@{$default_list}){ $default{$keyword} = $exports{$keyword} - || confess(qq{The $exporting_package package does not export "$keyword"}); + || Carp::confess(qq{The $exporting_package package does not export "$keyword"}); } $args{DEFAULT} = \%default; } @@ -141,7 +142,7 @@ sub do_import { my($package, @args) = @_; my $spec = $SPEC{$package} - || confess("The package $package package does not use Mouse::Exporter"); + || Carp::confess("The package $package package does not use Mouse::Exporter"); my $into = _get_caller_package(ref($args[0]) ? shift @args : undef); @@ -160,7 +161,7 @@ sub do_import { } elsif($arg =~ s/^://){ my $group = $spec->{groups}{$arg} - || confess(qq{The $package package does not export the group "$arg"}); + || Carp::confess(qq{The $package package does not export the group "$arg"}); push @exports, @{$group}; } else{ @@ -168,8 +169,11 @@ sub do_import { } } - $^H |= $strict_bits; # strict->import; - ${^WARNING_BITS} |= $warnings::Bits{all}; # warnings->import; + # strict->import; + $^H |= $strict_bits; + # warnings->import('all', FATAL => 'recursion'); + ${^WARNING_BITS} |= $warnings::Bits{all}; + ${^WARNING_BITS} |= $warnings_extra_bits; if($spec->{INIT_META}){ my $meta; @@ -203,7 +207,7 @@ sub do_import { foreach my $keyword(@exports){ push @export_table, $keyword => ($spec->{EXPORTS}{$keyword} - || confess(qq{The $package package does not export "$keyword"}) + || Carp::confess(qq{The $package package does not export "$keyword"}) ); } Mouse::Util::install_subroutines($into, @export_table); @@ -219,7 +223,7 @@ sub do_unimport { my($package, $arg) = @_; my $spec = $SPEC{$package} - || confess("The package $package does not use Mouse::Exporter"); + || Carp::confess("The package $package does not use Mouse::Exporter"); my $from = _get_caller_package($arg); @@ -264,7 +268,7 @@ Mouse::Exporter - make an import() and unimport() just like Mouse.pm =head1 VERSION -This document describes Mouse version 0.50_03 +This document describes Mouse version 0.77 =head1 SYNOPSIS