From 158309106e39902c42e24fdfe43dc29ad61aec87 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Mon, 20 Feb 2012 20:39:57 -0600 Subject: [PATCH] fix for CPAN#74826: CPAN #74687 and #73702 --- t/dump-code.t | 7 ++++--- t/dump-perl-types.t | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/t/dump-code.t b/t/dump-code.t index 8d30196..197831b 100644 --- a/t/dump-code.t +++ b/t/dump-code.t @@ -1,12 +1,13 @@ use t::TestYAML tests => 7; +use YAML (); # [CPAN #74687] must load before B::Deparse for B::Deparse < 0.71 use B::Deparse; if (new B::Deparse -> coderef2text ( sub { no strict; 1; use strict; 1; }) =~ 'refs') { local $/; - (my $data = ) =~ s/use strict/use strict 'refs'/g; - if ($B::Deparse::VERSION < 0.71) { - $data =~ s/use warnings;/BEGIN {\${^WARNING_BITS} = "UUUUUUUUUUUU\\001"}/g; + (my $data = ) =~ s/use strict/use strict 'refs'/g if $] < 5.015; + if ($B::Deparse::VERSION > 0.67 and $B::Deparse::VERSION < 0.71) { # [CPAN #73702] + $data =~ s/use warnings;/BEGIN {\${^WARNING_BITS} = "UUUUUUUUUUUU\\001"}/g; } open DATA, '<', \$data; } diff --git a/t/dump-perl-types.t b/t/dump-perl-types.t index c775b56..738ca11 100644 --- a/t/dump-perl-types.t +++ b/t/dump-perl-types.t @@ -2,6 +2,18 @@ use t::TestYAML tests => 14; filters { perl => ['eval', 'yaml_dump'] }; +use YAML (); # [CPAN #74687] must load before B::Deparse for B::Deparse < 0.71 +use B::Deparse; +if (new B::Deparse -> coderef2text ( sub { no strict; 1; use strict; 1; }) + =~ 'refs') { + local $/; + (my $data = ) =~ s/use strict/use strict 'refs'/g; + if ($B::Deparse::VERSION > 0.67 and $B::Deparse::VERSION < 0.71) { # [CPAN #73702] + $data =~ s/use warnings;/BEGIN {\${^WARNING_BITS} = "UUUUUUUUUUUU\\001"}/g; + } + open DATA, '<', \$data; +} + no_diff; run_is perl => 'yaml'; @@ -36,7 +48,7 @@ sub { print "Hello, world\n"; } --- !!perl/code | { use warnings; - use strict 'refs'; + use strict; print "Hello, world\n"; } @@ -82,7 +94,7 @@ NAME: var3 CODE: !!perl/code | { use warnings; - use strict 'refs'; + use strict; print "Hello, world\n"; } -- 1.7.5.4