FW: Cygwin Perl bug -- pod2usage(-verbose => 0) & pod2usage(-verbose => 1)

Reini Urban rurban@x-ray.at
Tue Jan 18 10:31:00 GMT 2005


David Christensen schrieb:
> pod-people & perlbug:
> I made the subject posting on the Cygwin mailing list.  Gerrit P. Haase
> confirmed the bug in pod2usage(), and requested that I forward the posting to
> pod-people and perlbug.  The referenced script attachments follow.

All three cases work fine for me on cygwin & perl 5.8.6 with default 
configuration.
Having the scripts on textmounts and on binmounts.

Just if the scripts are on textmounts and the files with CRLF, test0 and 
test1 will fail. PERLIO not set.

However:
   PERLIO=crlf ./test1
and
   PERLIO=crlf ./test0
works ok, with those textmount cases.

Debugging through Pod::Usage, reveils that reading from the tied 
FileHandle will keep \r\n. Looks ok.

Pod::Parser::parse_from_filehandle ...
   DB<1> x $in_fh
0  GLOB(0x8f2534)
    -> *Symbol::GEN0
          FileHandle({*Symbol::GEN0}) => fileno(6)
  DB<2> c Pod::Select::is_selected
Pod::Select::is_selected(/usr/lib/perl5/5.8/Pod/Select.pm:508):

$_ = "=head1 SYNOPSIS\cM\cJ\cM\cJ";
if (/^=((?:sub)*)(?:head(?:ing)?|sec(?:tion)?)(\d*)\s+(.*)\s*$/) {
    my ($level, $heading) = ($2, $3);
}

   DB<2> x $heading
0  "SYNOPSIS\cM"

Which should be "SYNOPSIS".

So my recommended fix would be this patch:

$ diff -bu Select.pm~ Select.pm
--- Select.pm~  2005-01-10 00:30:15.001000000 +0100
+++ Select.pm   2005-01-18 11:02:32.920797700 +0100
@@ -505,7 +505,7 @@

      ## Keep track of current sections levels and headings
      $_ = $paragraph;
-    if (/^=((?:sub)*)(?:head(?:ing)?|sec(?:tion)?)(\d*)\s+(.*)\s*$/) {
+    if (/^=((?:sub)*)(?:head(?:ing)?|sec(?:tion)?)(\d*)\s+(.*?)\s*$/) {
          ## This is a section heading command
          my ($level, $heading) = ($2, $3);
          $level = 1 + (length($1) / 3)  if ((! length $level) || 
(length $1));


> -----Original Message-----
> From: David Christensen [mailto: dpchrist at holgerdanske dot com] 
> Sent: Sunday, January 16, 2005 7:03 PM
> To: 'cygwin at cygwin dot com'
> Subject: Cygwin Perl bug -- pod2usage(-verbose => 0) & pod2usage(-verbose => 1)
> 
> Cygwin:
> 
> Perl Pod::Usage pod2usage(-verbose => 0) is supposed to display the Pod SYNOPSIS
> information (ref. 'perdoc Pod::Usage').  See attached script 'test0'.  On Debian
> 3.0r2, it works:
> 
>     <CVSENV>dpchrist@p166d302:~/cygwin-issues/Pod-Usage$ perl test0
>     Usage:
>         This is the synopsis...
> 
> On Cygwin, it exits without displaying anything.
> 
> pod2usage(-verbose => 1) is supposed to display the Pod SYNOPSIS, OPTIONS,
> ARGUMENTS, and/or OPTIONS AND ARGUMENTS sections.  See attached script 'test1'.
> On Debian, it works:
> 
>     <CVSENV>dpchrist@p166d302:~/cygwin-issues/Pod-Usage$ perl test1
>     Usage:
>         This is the synopsis...
> 
>     Options:
>         Here are the options...
> 
> On Cygwin, it exits without displaying anything.
> 
> 
> pod2usage(-verbose => 2) is supposed to display the entire Pod documentation.
> See attached script 'test2'.  It works on both Debian and Cygwin.
> 
> 
> Checking the mailing list archive, I see one report but no resolution:
> 
> 	http://sources.redhat.com/ml/cygwin/2002-01/msg01392.html
> 
> 
> Google didn't seem to have much on this either.
> 
> dpchrist@p42800e:~/mydocuments/cygwin-issues/Pod-Usage$ cat test0
> #! /usr/bin/perl -w
> use Pod::Usage;
> 
> pod2usage(-verbose => 0);
> 
> =pod
> 
> =head1 NAME
> 
> test - demonstrates Cygwin bug in pod2usage.
> 
> =head1 SYNOPSIS
> 
> This is the synopsis...
> 
> =head1 OPTIONS
> 
> Here are the options...
> 
> =head1 DESCRIPTION
> 
> Descriptive text...
> 
> =cut
> dpchrist@p42800e:~/mydocuments/cygwin-issues/Pod-Usage$ cat test1
> #! /usr/bin/perl -w
> use Pod::Usage;
> 
> pod2usage(-verbose => 1);
> 
> =pod
> 
> =head1 NAME
> 
> test - demonstrates Cygwin bug in pod2usage.
> 
> =head1 SYNOPSIS
> 
> This is the synopsis...
> 
> =head1 OPTIONS
> 
> Here are the options...
> 
> =head1 DESCRIPTION
> 
> Descriptive text...
> 
> =cut
> dpchrist@p42800e:~/mydocuments/cygwin-issues/Pod-Usage$ cat test2
> #! /usr/bin/perl -w
> use Pod::Usage;
> 
> pod2usage(-verbose => 2);
> 
> =pod
> 
> =head1 NAME
> 
> test - demonstrates Cygwin bug in pod2usage.
> 
> =head1 SYNOPSIS
> 
> This is the synopsis...
> 
> =head1 OPTIONS
> 
> Here are the options...
> 
> =head1 DESCRIPTION
> 
> Descriptive text...
> 
> =cut
-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list