From: Jerry D. Hedden Date: Fri, 2 Mar 2007 06:59:41 +0000 (-0800) Subject: 'Unknown PerlIO layer "encoding"...' message X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a37092fbc61eea427a132768737d48450e8466c;p=p5sagit%2Fp5-mst-13.2.git 'Unknown PerlIO layer "encoding"...' message From: "Jerry D. Hedden" Message-ID: <794180.55454.qm@web30208.mail.mud.yahoo.com> p4raw-id: //depot/perl@30485 --- diff --git a/lib/Pod/t/man.t b/lib/Pod/t/man.t index e09f8de..3ad1f83 100644 --- a/lib/Pod/t/man.t +++ b/lib/Pod/t/man.t @@ -29,6 +29,8 @@ use Pod::Man; $loaded = 1; print "ok 1\n"; +my $have_encoding = eval { require PerlIO::encoding; 1; } && ! $@; + my $parser = Pod::Man->new or die "Cannot create parser\n"; my $n = 2; while () { @@ -36,9 +38,8 @@ while () { open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; # We have a test in ISO 8859-1 encoding. Make sure that nothing strange - # happens if Perl thinks the world is Unicode. Wrap this in eval so that - # older versions of Perl don't croak. - eval { binmode (\*TMP, ':encoding(iso-8859-1)') }; + # happens if Perl thinks the world is Unicode. + binmode (\*TMP, ':encoding(iso-8859-1)') if $have_encoding; while () { last if $_ eq "###\n";