X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcontains_pod.t;h=0b2a57da4c83c15e3d6363431bad71ca50a4d6b3;hb=a2115d459dc9653398c3543e8deb41bbed014f08;hp=3edfe43099c46efe679d960fc1d8c26092fe7daa;hpb=b50a98018a199717f2932fa763ae64967d4c3ee2;p=p5sagit%2FModule-Metadata.git 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'); }