Checking in changes prior to tagging of version 0.79.
[gitmo/Mouse.git] / lib / Mouse / Exporter.pm
index 2ee752b..37e459a 100644 (file)
@@ -2,19 +2,26 @@ package Mouse::Exporter;
 use strict;
 use warnings;
 
-use Carp qw(confess);
+use Carp ();
 
 my %SPEC;
 
-use constant _strict_bits => strict::bits(qw(subs refs vars));
+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;
 }
 
@@ -43,7 +50,7 @@ sub setup_import_methods{
 }
 
 sub build_import_methods{
-    my($class, %args) = @_;
+    my($self, %args) = @_;
 
     my $exporting_package = $args{exporting_package} ||= caller();
 
@@ -113,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;
     }
@@ -135,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);
 
@@ -154,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{
@@ -162,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;
@@ -197,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);
@@ -213,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);
 
@@ -258,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.79
 
 =head1 SYNOPSIS