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 23, 2000 17:18
Subject:
Re: [ID 20000405.021] Pod::Man bug
Message ID:
yl8zy4bbd8.fsf@windlord.stanford.edu
Todd C Miller <Todd.Miller@courtesan.com> writes:

> Sorry, that must have been a mispaste.  What pod2man produces is:
>     \f(CW\*(C`\e-u\*(C'\fR

> which does have the backslash in the formatted output.  The
> "\\" is replaced by "\\e" by verbatim().

Ah!  I see.

Brad, this bit of code looks odd to me, from Pod::InputObjects in
Pod::Parser 1.13:

sub children {
   my $self = shift;
   if (@_ > 0) {
      @{ $self } = (@_ == 1  and  ref $_[0]) ? ${ @_ } : @_;
   }
   return @{ $self };
}

Shouldn't that be "(@_ == 1  and  ref $_[0]) ? @{ @_ } : @_"?  I believe
the current code will evaluate @_ in a scalar context and then always try
to dereference "1" as a scalar reference if @_ == 1.

Todd, try this patch.  I wasn't properly tagging the pre-processed text
blocks inside a C<> sequence.

--- Man.pm	2000/04/09 09:23:54	1.3
+++ Man.pm	2000/04/24 00:13:49
@@ -555,14 +555,20 @@
     # 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;
+        my @children = map {
+            my $block = $_;
+            if (ref $block) {
+                $block;
+            } else {
+                $block =~ s/-/\\-/g;
+                $block =~ s/__/_\\|_/g;
+                bless \ "$block", 'Pod::Man::String';
             }
-        }
-        $seq->parse_tree ()->children (@children);
+        } $seq->parse_tree ()->children;
+
+        # The extra empty block is to work around a bug in the children
+        # method in Pod::Parser 1.13.
+        $seq->parse_tree ()->children ('', @children);
     }
 
     # C<>, L<>, X<>, and E<> don't apply guesswork to their contents.

-- 
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