Checking in changes prior to tagging of version 0.78.
[gitmo/Mouse.git] / lib / Mouse / Exporter.pm
index e44c256..5da4968 100644 (file)
@@ -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;
 }
 
@@ -44,7 +50,7 @@ sub setup_import_methods{
 }
 
 sub build_import_methods{
-    my($class, %args) = @_;
+    my($self, %args) = @_;
 
     my $exporting_package = $args{exporting_package} ||= caller();
 
@@ -114,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;
     }
@@ -136,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);
 
@@ -155,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{
@@ -163,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;
@@ -198,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);
@@ -214,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);
 
@@ -259,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.78
 
 =head1 SYNOPSIS