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

Re: pod2man deficiencies

Thread Previous
From:
Russ Allbery
Date:
March 16, 2000 13:11
Subject:
Re: pod2man deficiencies
Message ID:
ylhfe6y60d.fsf@windlord.stanford.edu
Gregor N Purdy <gregor@focusresearch.com> writes:

> Is anyone out there besides me interested in having pod2man be callable
> in a pipeline?

Sure.  It was always the intention for it to work right.

> I want to run a program that outputs POD on standard out and pipe it in:

> 	foo x.pod | pod2man | nroff

This works fine for me with the pod2man in the current release candidate
and Pod::Parser 1.13.

> Since pod2man requires a filename, I tried:

> 	foo x.pod | pod2man - | nroff

> but pod2man things the '-' is a malformed option.

This seems to fix that:

--- pod2man.PL  2000/03/16 20:38:51     1.1
+++ pod2man.PL  2000/03/16 21:08:23     1.2
@@ -36,7 +36,7 @@
 print OUT <<'!NO!SUBS!';
 
 # pod2man -- Convert POD data to formatted *roff input.
-# $Id: pod2man.PL,v 1.1 2000/03/16 20:38:51 eagle Exp $
+# $Id: pod2man.PL,v 1.2 2000/03/16 21:08:23 eagle Exp $
 #
 # Copyright 1999, 2000 by Russ Allbery <rra@stanford.edu>
 #
@@ -50,7 +50,12 @@
 use Pod::Usage qw(pod2usage);
 
 use strict;
-use vars;
+
+# Insert -- into @ARGV before any single dash argument to hide it from
+# Getopt::Long; we want to interpret it as meaning stdin (which Pod::Parser
+# does correctly).
+my $stdin;
+@ARGV = map { $_ eq '-' && !$stdin++ ? ('--', $_) : $_ } @ARGV;
 
 # Parse our options, trying to retain backwards compatibility with pod2man
 # but allowing short forms as well.  --lax is currently ignored.

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

Thread Previous


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