develooper Front page | perl.perl5.porters | Postings from April 2000

Re: [ID 20000405.021] Pod::Man bug

Thread Previous | Thread Next
From:
Russ Allbery
Date:
April 8, 2000 20:41
Subject:
Re: [ID 20000405.021] Pod::Man bug
Message ID:
ylr9cgaqll.fsf@windlord.stanford.edu
Todd C Miller <Todd.Miller@courtesan.com> writes:

> Pod::Man (and thus pod2man) generates man pages with a syntax error.
> Given a sequence like this:
>     C<I<FLAGS> & IPC_CREAT>

> pod2man will generate:
>     \f(CW\*(C`\f(CI\s\-1FLAGS\s0\f(CW & IPC_CREAT\*(C'\fR

That was an annoying one.  Thanks for the catch.  Could you try this patch
and let me know if it fixes the problem?

diff -u -r1.2 Man.pm
--- Man.pm	2000/03/19 07:30:13	1.2
+++ Man.pm	2000/04/09 03:37:39
@@ -550,6 +550,21 @@
         return bless \ "$tmp", 'Pod::Man::String';
     }
 
+    # C<> needs to fix hyphens and underscores but can't apply guesswork and
+    # can't just apply those fixes to the entire string, since then it might
+    # mess up the results of guesswork on substrings.  So we do this
+    # somewhat roundabout way of handling it.
+    if ($command eq 'C') {
+        my @children = $seq->parse_tree ()->children;
+        for (@children) {
+            unless (ref) {
+                s/-/\\-/g;
+                s/__/_\\|_/g;
+            }
+        }
+        $seq->parse_tree ()->children (@children);
+    }
+
     # C<>, L<>, X<>, and E<> don't apply guesswork to their contents.
     local $_ = $self->collapse ($seq->parse_tree, $command =~ /^[CELX]$/);
 
@@ -576,8 +591,6 @@
     } elsif ($command eq 'I') {
         return bless \ ('\f(IS' . $_ . '\f(IE'), 'Pod::Man::String';
     } elsif ($command eq 'C') {
-        s/-/\\-/g;
-        s/__/_\\|_/g;
         return bless \ ('\f(FS\*(C`' . $_ . "\\*(C'\\f(FE"),
             'Pod::Man::String';
     }

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About