From: Peter Rabbitson Date: Wed, 8 May 2013 21:01:31 +0000 (+0200) Subject: Backcompaterize X-Git-Tag: v1.000013~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d86d0e2183cea90009277c05713594679c799d3;p=p5sagit%2FModule-Metadata.git Backcompaterize --- diff --git a/Changes b/Changes index 98a5bb9..e057747 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Release history for Module-Metadata + - Fix reliance on recent Test::Builder + - Make tests perl 5.6 compatible + 1.000012 - 2013-05-04 - improved package detection heuristics (thanks, Edward Zborowski!) - fix ->contains_pod (RT#84932, Tokuhiro Matsuno) diff --git a/Makefile.PL b/Makefile.PL index a2b9747..c4f0312 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -18,6 +18,10 @@ WriteMakefile( 'vars' => 0, 'version' => 0.87, 'warnings' => 0, + $] < 5.008 + ? ( 'IO::Scalar' => 0 ) + : () + , }, META_MERGE => { dynamic_config => 0, diff --git a/t/contains_pod.t b/t/contains_pod.t index 3edfe43..0b2a57d 100644 --- a/t/contains_pod.t +++ b/t/contains_pod.t @@ -3,13 +3,23 @@ use warnings; use Test::More tests => 3; use Module::Metadata; +*fh_from_string = $] < 5.008 + ? require IO::Scalar && sub ($) { + IO::Scalar->new(\$_[0]); + } + : sub ($) { + open my $fh, '<', \$_[0]; + $fh + } +; + { my $src = <<'...'; package Foo; 1; ... - open my $fh, '<', \$src; + my $fh = fh_from_string($src); my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm'); ok(!$module->contains_pod(), 'This module does not contains POD'); } @@ -24,7 +34,7 @@ package Foo; Foo - bar ... - open my $fh, '<', \$src; + my $fh = fh_from_string($src); my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm'); ok($module->contains_pod(), 'This module contains POD'); } @@ -43,7 +53,7 @@ Foo - bar Tokuhiro Matsuno ... - open my $fh, '<', \$src; + my $fh = fh_from_string($src); my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm'); ok($module->contains_pod(), 'This module contains POD'); } diff --git a/t/endpod.t b/t/endpod.t index 6ee0ff2..815ec91 100644 --- a/t/endpod.t +++ b/t/endpod.t @@ -1,7 +1,7 @@ use strict; use warnings; use utf8; -use Test::More; +use Test::More tests => 2; use Module::Metadata; # This test case tests about parsing pod after `__END__` token. @@ -9,6 +9,3 @@ use Module::Metadata; my $pm_info = Module::Metadata->new_from_file('t/lib/ENDPOD.pm', collect_pod => 1,); is( $pm_info->name, 'ENDPOD', 'found default package' ); is(join(',', $pm_info->pod_inside), 'NAME'); - -done_testing; -