In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/35968441ced92c07a7f60de65b5207e406d560d4?hp=9617fa1ef1efc315796404f56adfda451b173a44>

- Log -----------------------------------------------------------------
commit 35968441ced92c07a7f60de65b5207e406d560d4
Merge: 9617fa1 eee0619
Author: Tony Cook <[email protected]>
Date:   Fri Jul 26 11:09:11 2013 +1000

    [perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers

commit eee06191b6a7f5cfe36afc532c5e63c282bc88d0
Author: Tony Cook <[email protected]>
Date:   Fri Jul 26 11:00:23 2013 +1000

    bump $Exporter::VERSION (and hence $Exporter::Heavy::VERSION)

M       dist/Exporter/lib/Exporter.pm

commit d7d11da6a3137eab7a1218de09cab6f2bbfc85ce
Author: Tony Cook <[email protected]>
Date:   Thu Jul 18 16:03:19 2013 +1000

    [perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers

M       dist/Exporter/lib/Exporter/Heavy.pm
M       dist/Exporter/t/warn.t

commit 0fe08b2b23c9e50663374a37f787ff18c914b79f
Author: Tony Cook <[email protected]>
Date:   Thu Jul 18 16:02:29 2013 +1000

    [perl #39739] TODO test for Exporter respecting warning handlers

M       MANIFEST
A       dist/Exporter/t/warn.t
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                            |  1 +
 dist/Exporter/lib/Exporter.pm       |  2 +-
 dist/Exporter/lib/Exporter/Heavy.pm |  5 +++++
 dist/Exporter/t/warn.t              | 39 +++++++++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 dist/Exporter/t/warn.t

diff --git a/MANIFEST b/MANIFEST
index e7e153c..77b71fc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2975,6 +2975,7 @@ dist/Env/t/env.t          See if Env works
 dist/Exporter/lib/Exporter/Heavy.pm    Complicated routines for Exporter
 dist/Exporter/lib/Exporter.pm          Exporter base class
 dist/Exporter/t/Exporter.t             See if Exporter works
+dist/Exporter/t/warn.t                 See if Exporter respects warning 
handlers
 dist/ExtUtils-CBuilder/Changes         EU-CB change log
 dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm           Base class for 
ExtUtils::CBuilder methods
 dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm   CBuilder 
methods for AIX
diff --git a/dist/Exporter/lib/Exporter.pm b/dist/Exporter/lib/Exporter.pm
index f7564f7..fc05e5f 100644
--- a/dist/Exporter/lib/Exporter.pm
+++ b/dist/Exporter/lib/Exporter.pm
@@ -9,7 +9,7 @@ require 5.006;
 our $Debug = 0;
 our $ExportLevel = 0;
 our $Verbose ||= 0;
-our $VERSION = '5.68';
+our $VERSION = '5.69';
 our (%Cache);
 
 sub as_heavy {
diff --git a/dist/Exporter/lib/Exporter/Heavy.pm 
b/dist/Exporter/lib/Exporter/Heavy.pm
index 724028a..21b67c1 100644
--- a/dist/Exporter/lib/Exporter/Heavy.pm
+++ b/dist/Exporter/lib/Exporter/Heavy.pm
@@ -38,8 +38,13 @@ sub _rebuild_cache {
 
 sub heavy_export {
 
+    # Save the old __WARN__ handler in case it was defined
+    my $oldwarn = $SIG{__WARN__};
+
     # First make import warnings look like they're coming from the "use".
     local $SIG{__WARN__} = sub {
+       # restore it back so proper stacking occurs
+       local $SIG{__WARN__} = $oldwarn;
        my $text = shift;
        if ($text =~ s/ at \S*Exporter\S*.pm line \d+.*\n//) {
            require Carp;
diff --git a/dist/Exporter/t/warn.t b/dist/Exporter/t/warn.t
new file mode 100644
index 0000000..3010964
--- /dev/null
+++ b/dist/Exporter/t/warn.t
@@ -0,0 +1,39 @@
+#!perl -w
+
+# Can't use Test::Simple/More, they depend on Exporter.
+my $test;
+sub ok ($;$) {
+    my($ok, $name) = @_;
+
+    # You have to do it this way or VMS will get confused.
+    printf "%sok %d%s\n", ($ok ? '' : 'not '), $test,
+      (defined $name ? " - $name" : '');
+
+    printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+
+    $test++;
+    return $ok;
+}
+
+
+BEGIN {
+    $test = 1;
+    print "1..2\n";
+    require Exporter;
+    ok( 1, 'Exporter compiled' );
+}
+
+package Foo;
+Exporter->import("import");
+@EXPORT_OK = "bar";
+
+package main;
+
+{ # [perl #39739] Exporter::Heavy ignores custom $SIG{__WARN__} handlers
+    my @warn;
+
+    local $SIG{__WARN__} = sub { push @warn, join "", @_ };
+    eval { Foo->import(":quux") };
+    ok(grep(/"quux" is not defined/, @warn), "warnings captured");
+}
+

--
Perl5 Master Repository

Reply via email to