Steve Peters <[EMAIL PROTECTED]> writes:

> Unfortunately, the new version of podlators causes test failures in
> lib/Pod/t/Usage.t.(*)

The test suite is capturing output by tying the output file handle to a
class that stores the output in a string, but that class doesn't implement
close.  Pod::Man and Pod::Text in 2.0.1 close the filehandle in
parse_from_file to force a flush of output since Pod::Simple otherwise
doesn't flush.  The more I think about it, that's the wrong thing to do,
so I've changed the code to just flush the file handle instead.

Incidentally, can anyone tell me why I have to do:

    my $fh = $self->output_fh ();
    my $oldfh = select $fh;
    my $oldflush = $|;
    $| = 1;
    print $fh '';
    $| = $oldflush;
    select $oldfh;

instead of the obvious:

    my $fh = $self->output_fh ();
    $fh->flush ();

which the IO::Handle documentation seems to indicate is supposed to work?
If I do the latter, I just get "Can't locate object method "flush" via
package "IO::Handle" at ../blib/lib/Pod/Text.pm line 594."  This is with
Perl 5.8.7.

> I also must have forgotten to send you updates to t/man.t.  This change
> was to TODO various tests that were not Unicode friendly.  The patch for
> this is included below against podlators-2.0.

Pod::Man supports Unicode, so it took me a little bit to figure out what
was really wrong here.  The right fix is:

--- t/man.t     20 Jan 2006 21:20:58 -0000      1.6
+++ t/man.t     25 Jan 2006 23:14:24 -0000
@@ -34,6 +34,12 @@ my $n = 2;
 while (<DATA>) {
     next until $_ eq "###\n";
     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)') };
+
     while (<DATA>) {
         last if $_ eq "###\n";
         print TMP $_;
@@ -139,6 +145,8 @@ Also not a bullet.
 ###
 
 ###
+=encoding iso-8859-1
+
 =head1 ACCENTS
 
 Beyoncé!  Beyoncé!  Beyoncé!!

Two things are needed: first, the temporary file to which the POD is
written has to not have a UTF-8 layer or otherwise the input is
automatically translated by Perl into UTF-8 as near as I can tell, and
second, there was a missing =encoding to tell Pod::Simple what the
encoding of the input is.

With this fix, everything looks good in Perl 5.8.7 and in 5.6.1.  A new
release is coming in a few minutes.

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>

Reply via email to