summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-10-02 09:48:17 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-10-02 09:48:17 +0000
commit72c5b54791bd181146517f6bafda5efb6e1de133 (patch)
tree2953cab5828460df522cfffcaa0be04776e7cf66
parentb3c0bf3602cfb95d459cdd04ae7ddfd23779e14e (diff)
parent9741dab02becad0550bba7d5ca9e59f8ac608b2d (diff)
downloadperl-72c5b54791bd181146517f6bafda5efb6e1de133.tar.gz
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@4283
-rw-r--r--Changes546
-rw-r--r--MANIFEST9
-rw-r--r--av.c25
-rw-r--r--configure.com21
-rwxr-xr-xemacs/ptags31
-rw-r--r--ext/attrs/attrs.pm19
-rw-r--r--ext/attrs/attrs.xs6
-rw-r--r--lib/Pod/Checker.pm63
-rw-r--r--lib/Pod/InputObjects.pm46
-rw-r--r--lib/Pod/Man.pm1185
-rw-r--r--lib/Pod/Parser.pm364
-rw-r--r--lib/Pod/PlainText.pm650
-rw-r--r--lib/Pod/Select.pm7
-rw-r--r--lib/Pod/Text.pm198
-rw-r--r--lib/Pod/Text/Color.pm21
-rw-r--r--lib/Pod/Text/Termcap.pm19
-rw-r--r--lib/Pod/Usage.pm20
-rw-r--r--pod/perlfunc.pod11
-rw-r--r--pod/pod2man.PL1401
-rw-r--r--pod/pod2text.PL72
-rw-r--r--pod/pod2usage.PL5
-rw-r--r--pod/podchecker.PL5
-rw-r--r--pod/podselect.PL5
-rwxr-xr-xt/lib/thread.t7
-rwxr-xr-xt/op/avhv.t12
-rwxr-xr-xt/pod/emptycmd.t6
-rwxr-xr-xt/pod/for.t6
-rw-r--r--t/pod/for.xr16
-rwxr-xr-xt/pod/headings.t6
-rw-r--r--t/pod/headings.xr29
-rwxr-xr-xt/pod/include.t6
-rw-r--r--t/pod/include.xr15
-rwxr-xr-xt/pod/included.t6
-rw-r--r--t/pod/included.xr4
-rwxr-xr-xt/pod/lref.t6
-rw-r--r--t/pod/lref.xr14
-rwxr-xr-xt/pod/multiline_items.t31
-rw-r--r--t/pod/multiline_items.xr5
-rwxr-xr-xt/pod/nested_items.t6
-rw-r--r--t/pod/nested_items.xr4
-rwxr-xr-xt/pod/nested_seqs.t6
-rw-r--r--t/pod/nested_seqs.xr4
-rwxr-xr-xt/pod/oneline_cmds.t6
-rw-r--r--t/pod/oneline_cmds.xr29
-rwxr-xr-xt/pod/pod2usage.t18
-rw-r--r--t/pod/pod2usage.xr55
-rwxr-xr-xt/pod/poderrs.t6
-rw-r--r--t/pod/poderrs.xr22
-rwxr-xr-xt/pod/podselect.t18
-rw-r--r--t/pod/podselect.xr42
-rwxr-xr-xt/pod/special_seqs.t6
-rw-r--r--t/pod/special_seqs.xr14
-rw-r--r--t/pod/testp2pt.pl30
-rw-r--r--t/pod/testpchk.pl10
-rwxr-xr-xt/pragma/sub_lval.t46
-rw-r--r--utils/h2xs.PL72
-rw-r--r--vms/vms.c4
57 files changed, 3070 insertions, 2226 deletions
diff --git a/Changes b/Changes
index 6ac09ad1ed..76e7970852 100644
--- a/Changes
+++ b/Changes
@@ -79,6 +79,486 @@ Version 5.005_62 Development release working toward 5.006
----------------
____________________________________________________________________________
+[ 4273] By: gsar on 1999/10/01 22:58:55
+ Log: typo, whitespace adjustments
+ Branch: perl
+ ! utils/h2xs.PL
+____________________________________________________________________________
+[ 4272] By: gsar on 1999/10/01 22:46:06
+ Log: remove dup hunks
+ Branch: perl
+ ! configure.com vms/vms.c
+____________________________________________________________________________
+[ 4271] By: gsar on 1999/10/01 22:33:02
+ Log: integrate cfgperl contents into mainline; resolve h2xs.PL conflict
+ by declaring new globals "our" (XXX this means h2xs generated code
+ won't run on earlier versions; a switch to generate compatible
+ source is needed)
+ Branch: perl
+ !> (integrate 35 files)
+____________________________________________________________________________
+[ 4270] By: jhi on 1999/10/01 12:05:56
+ Log: Integrate with Sarathy.
+ Branch: cfgperl
+ !> ext/B/B/C.pm lib/ExtUtils/typemap lib/ExtUtils/xsubpp
+ !> pod/perldiag.pod util.c
+____________________________________________________________________________
+[ 4269] By: jhi on 1999/10/01 10:26:19
+ Log: From: Piotr Klaban <makler@oryl.man.torun.pl>
+ To: perl5-porters@perl.org
+ Subject: [ID 19991001.001] perlguts man page error
+ Date: Fri, 1 Oct 1999 10:23:49 +0200 (MET DST)
+ Message-Id: <199910010823.KAA05796@oryl.man.torun.pl>
+ Branch: cfgperl
+ ! pod/perlguts.pod
+____________________________________________________________________________
+[ 4268] By: jhi on 1999/10/01 07:32:33
+ Log: There *is* a month called October.
+ Branch: cfgperl
+ ! t/op/time.t
+____________________________________________________________________________
+[ 4267] By: jhi on 1999/10/01 06:58:10
+ Log: Temp file cleanliness.
+ Branch: cfgperl
+ ! t/lib/filecopy.t
+____________________________________________________________________________
+[ 4266] By: jhi on 1999/10/01 06:46:56
+ Log: From: Barrie Slaymaker <barries@slaysys.com>
+ To: perl5-porters@perl.org
+ Subject: [PATCH 5.005_61] Benchmark.pm: Export countit(), cmpthese() by default
+ Date: Thu, 30 Sep 1999 22:16:26 -0400
+ Message-Id: <199910010216.WAA08309@jester.slaysys.com>
+ Branch: cfgperl
+ ! lib/Benchmark.pm
+____________________________________________________________________________
+[ 4265] By: jhi on 1999/09/30 20:25:35
+ Log: From: Barrie Slaymaker <barries@slaysys.com>
+ To: perl5-porters@perl.org
+ Subject: [PATCH 5.005_61] Benchmark tweaks, fixes, cmpthese()
+ Date: Thu, 30 Sep 1999 15:44:00 -0400
+ Message-Id: <199909301944.PAA07166@jester.slaysys.com>
+ (Replaces #4175.)
+ Branch: cfgperl
+ ! lib/Benchmark.pm
+____________________________________________________________________________
+[ 4264] By: gsar on 1999/09/30 17:59:26
+ Log: re-add missing "Out of memory!" entry
+ Branch: perl
+ ! pod/perldiag.pod
+____________________________________________________________________________
+[ 4263] By: jhi on 1999/09/30 17:05:43
+ Log: Regenerate Configure.
+ Branch: cfgperl
+ ! Configure Porting/Glossary Porting/config.sh Porting/config_H
+ ! config_h.SH
+____________________________________________________________________________
+[ 4261] By: jhi on 1999/09/30 16:15:05
+ Log: From: Andy Dougherty <doughera@lafayette.edu>
+ To: Perl Porters <perl5-porters@perl.org>
+ Subject: [PATCH 5.005_61] rand() advisory for perldelta.pod
+ Date: Thu, 30 Sep 1999 12:24:00 -0400 (EDT)
+ Message-ID: <Pine.SOL.4.10.9909301218390.3343-100000@maxwell.phys.lafayette.edu>
+ Branch: cfgperl
+ ! pod/perldelta.pod
+____________________________________________________________________________
+[ 4260] By: jhi on 1999/09/30 15:48:56
+ Log: From: Andy Dougherty <doughera@lafayette.edu>
+ To: Jarkko Hietaniemi <jhi@iki.fi>, Gurusamy Sarathy <gsar@activestate.com>
+ Subject: Re: Possible skeletal structure for searching multiple versions
+ Date: Thu, 30 Sep 1999 11:52:00 -0400 (EDT)
+ Message-ID: <Pine.SOL.4.10.9909301149090.3343-100000@maxwell.phys.lafayette.edu>
+ Branch: metaconfig
+ ! U/mkglossary
+ Branch: metaconfig/U/perl
+ + xs_apiversion.U
+ ! patchlevel.U
+____________________________________________________________________________
+[ 4259] By: jhi on 1999/09/30 15:07:16
+ Log: Further ?idsize.U fixing.
+ Branch: metaconfig
+ ! U/typedefs/gidsize.U U/typedefs/pidsize.U U/typedefs/uidsize.U
+____________________________________________________________________________
+[ 4258] By: jhi on 1999/09/30 15:00:14
+ Log: Fix the ?idsi{gn,ze} units, from Andy Dougherty.
+ Branch: metaconfig
+ ! U/typedefs/gidsign.U U/typedefs/gidsize.U U/typedefs/pidsign.U
+ ! U/typedefs/pidsize.U U/typedefs/uidsign.U U/typedefs/uidsize.U
+____________________________________________________________________________
+[ 4257] By: jhi on 1999/09/30 09:48:33
+ Log: From: "Kurt D. Starsinic" <kstar@chapin.edu>
+ To: Gurusamy Sarathy <gsar@ActiveState.com>
+ Cc: tchrist@perl.com, Larry Wall <larry@wall.org>,
+ The Perl Porters Mailing List <perl5-porters@perl.org>
+ Subject: [PATCH] (Was: deprecating SIGDIE)
+ Date: Wed, 29 Sep 1999 15:16:50 -0400
+ Message-ID: <19990929151650.E26675@O2.chapin.edu>
+ Branch: cfgperl
+ ! Porting/findvars embedvar.h intrpvar.h mg.c objXSUB.h perl.c
+____________________________________________________________________________
+[ 4256] By: jhi on 1999/09/30 09:45:22
+ Log: From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: Gurusamy Sarathy <gsar@activestate.com>
+ Cc: Barrie Slaymaker <barries@slaysys.com>, perl5-porters@perl.org
+ Subject: Re: _58, _61 Argument "" is not numeric in sprintf
+ Date: Wed, 29 Sep 1999 18:58:23 -0400
+ Message-ID: <19990929185823.A22099@monk.mps.ohio-state.edu>
+ Branch: cfgperl
+ ! Makefile.SH opcode.pl
+____________________________________________________________________________
+[ 4255] By: gsar on 1999/09/30 09:03:48
+ Log: remove prehistoric XFree() gunk
+ Branch: perl
+ ! lib/ExtUtils/typemap lib/ExtUtils/xsubpp
+____________________________________________________________________________
+[ 4254] By: gsar on 1999/09/30 08:40:14
+ Log: From: Vishal Bhatia <vishal@gol.com>
+ Date: Wed, 29 Sep 1999 23:27:28 +0900 (JST)
+ Message-ID: <Pine.LNX.4.10.9909292326280.5599-100000@localhost.localdomain>
+ Subject: [patch _61] Minor corrections in C.pm
+ Branch: perl
+ ! ext/B/B/C.pm
+____________________________________________________________________________
+[ 4253] By: gsar on 1999/09/30 08:36:27
+ Log: off-by-one in fbm_compile() (spotted by John Bley
+ <jbley@cs.cmu.edu>); whitespace adjustments
+ Branch: perl
+ ! util.c
+____________________________________________________________________________
+[ 4251] By: jhi on 1999/09/30 08:09:13
+ Log: From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: perl5-porters@perl.org (Mailing list Perl5)
+ Subject: [PATCH 5.00561+] Followup h2xs patch
+ Date: Thu, 30 Sep 1999 04:15:52 -0400 (EDT)
+ Message-Id: <199909300815.EAA25425@monk.mps.ohio-state.edu>
+ Branch: cfgperl
+ ! utils/h2xs.PL
+____________________________________________________________________________
+[ 4250] By: jhi on 1999/09/29 19:11:32
+ Log: Integrate with Sarathy.
+ Branch: cfgperl
+ !> djgpp/configure.bat embed.h embed.pl lib/Exporter/Heavy.pm
+ !> lib/ExtUtils/MM_Unix.pm lib/Time/Local.pm proto.h
+ !> t/pragma/locale/latin1 win32/Makefile win32/makefile.mk
+____________________________________________________________________________
+[ 4249] By: bailey on 1999/09/29 02:21:31
+ Log: resync with mainline
+ Branch: vmsperl
+ +> (branch 32 files)
+ - ext/B/defsubs.h.PL lib/unicode/arabshp.txt
+ - lib/unicode/blocks.txt lib/unicode/index2.txt
+ - lib/unicode/jamo2.txt lib/unicode/names2.txt
+ - lib/unicode/props2.txt lib/unicode/readme.txt
+ - t/lib/bigfloatpm.t
+ !> (integrate 240 files)
+____________________________________________________________________________
+[ 4248] By: jhi on 1999/09/28 18:14:39
+ Log: From: Andy Dougherty <doughera@lafayette.edu>
+ To: Perl Porters <perl5-porters@perl.org>
+ Subject: [PATCH 5.005_xx] Re: [Config 5.005_03] -DDEBUGGING
+ Date: Tue, 28 Sep 1999 12:20:50 -0400 (EDT)
+ Message-ID: <Pine.SOL.4.10.9909281019360.1890-100000@maxwell.phys.lafayette.edu>
+
+ From: Andy Dougherty <doughera@lafayette.edu>
+ To: Perl Porters <perl5-porters@perl.org>
+ Subject: [ANOTHER PATCH 5.005_61] Re: [Config 5.005_03] -DDEBUGGING
+ Date: Tue, 28 Sep 1999 13:39:49 -0400 (EDT)
+ Message-ID: <Pine.SOL.4.10.9909281338180.2012-100000@maxwell.phys.lafayette.edu>
+ Branch: cfgperl
+ ! hints/README.hints hints/amigaos.sh hints/cygwin.sh
+ ! hints/dynixptx.sh hints/epix.sh hints/esix4.sh hints/mint.sh
+ ! hints/mpeix.sh hints/next_3.sh hints/next_3_0.sh
+ ! hints/next_4.sh
+____________________________________________________________________________
+[ 4247] By: gsar on 1999/09/28 17:36:59
+ Log: revert change#4115 (breaks libwww's base/date.t); could be
+ reworked to enable it conditional on $Time::Local::nocroak
+ or some such
+ Branch: perl
+ ! lib/Time/Local.pm
+____________________________________________________________________________
+[ 4246] By: gsar on 1999/09/28 17:33:14
+ Log: tweak for win32 build
+ Branch: perl
+ ! win32/Makefile win32/makefile.mk
+____________________________________________________________________________
+[ 4245] By: gsar on 1999/09/28 17:31:34
+ Log: change#4236 fallout
+ Branch: perl
+ ! lib/ExtUtils/MM_Unix.pm
+____________________________________________________________________________
+[ 4244] By: gsar on 1999/09/28 17:29:31
+ Log: remove doubled new_xpv
+ Branch: perl
+ ! embed.h embed.pl proto.h
+____________________________________________________________________________
+[ 4243] By: jhi on 1999/09/27 19:13:20
+ Log: Artistic fine-tuning.
+ Branch: cfgperl
+ ! ext/B/defsubs_h.PL
+____________________________________________________________________________
+[ 4242] By: gsar on 1999/09/27 17:05:22
+ Log: avoid implicit split to @_ in change#4181; binary -> text file
+ types in p4
+ Branch: perl
+ ! djgpp/configure.bat lib/Exporter/Heavy.pm
+ ! t/pragma/locale/latin1
+____________________________________________________________________________
+[ 4241] By: jhi on 1999/09/27 07:48:19
+ Log: Integrate with Sarathy.
+ Branch: cfgperl
+ !> INSTALL embed.h embed.pl malloc.c pod/perldiag.pod pp.c
+ !> pp_ctl.c pp_hot.c pp_sys.c win32/Makefile win32/makefile.mk
+____________________________________________________________________________
+[ 4240] By: jhi on 1999/09/27 07:47:11
+ Log: Finalize change #4232.
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: Jarkko Hietaniemi <jhi@iki.fi>
+ Cc: gsar@activestate.com, Mailing list Perl5 <perl5-porters@perl.org>
+ Subject: Re: xsubpp change breaks B, DB_File, POSIX builds
+ Date: Sun, 26 Sep 1999 16:52:31 -0400
+ Message-ID: <19990926165230.A26933@monk.mps.ohio-state.edu>
+ Branch: cfgperl
+ ! lib/ExtUtils/xsubpp
+____________________________________________________________________________
+[ 4239] By: gsar on 1999/09/27 02:48:42
+ Log: add notes in INSTALL about Configure -Accflags=-DFOO
+ Branch: perl
+ ! INSTALL
+____________________________________________________________________________
+[ 4238] By: gsar on 1999/09/27 02:03:48
+ Log: PERL_POLLUTE isn't required for bincompat, so don't enable
+ it automatically
+ Branch: perl
+ ! embed.h embed.pl
+____________________________________________________________________________
+[ 4237] By: gsar on 1999/09/27 01:52:47
+ Log: From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Date: Fri, 24 Sep 1999 23:25:36 -0400
+ Message-ID: <19990924232536.A16257@monk.mps.ohio-state.edu>
+ Subject: [PATCH 5.005_61] Malloc fixes and docs
+ Branch: perl
+ ! malloc.c pod/perldiag.pod
+____________________________________________________________________________
+[ 4236] By: gsar on 1999/09/27 01:31:32
+ Log: avoid .exe in $Config{cc} (spotted by Vadim Konovalov
+ <vkonovalov@lucent.com>)
+ Branch: perl
+ ! win32/Makefile win32/makefile.mk
+____________________________________________________________________________
+[ 4235] By: gsar on 1999/09/26 17:02:03
+ Log: fix buggy popping of subroutine contexts in the lvalue
+ subroutines implementation (change#4081); correct the
+ plethora of cases where DIE() was more appropriate than
+ croak()
+ Branch: perl
+ ! pp.c pp_ctl.c pp_hot.c pp_sys.c
+____________________________________________________________________________
+[ 4234] By: jhi on 1999/09/26 12:06:28
+ Log: Fix #endif.
+ Branch: cfgperl
+ ! XSUB.h
+____________________________________________________________________________
+[ 4233] By: jhi on 1999/09/26 11:59:18
+ Log: Integrate with Sarathy. h2xs.PL had to be manually resolved,
+ I kept my (Ilya's) version.
+ Branch: cfgperl
+ !> gv.c gv.h intrpvar.h keywords.h keywords.pl lib/Shell.pm op.c
+ !> pod/perldiag.pod pod/perlembed.pod pod/perlfaq3.pod
+ !> pod/perlfaq7.pod pod/perlfunc.pod pod/perlmod.pod
+ !> pod/perlmodlib.pod pod/perlsub.pod pod/perltoot.pod
+ !> pod/perlxstut.pod sv.h t/pragma/strict-vars toke.c
+ !> utils/h2xs.PL win32/Makefile win32/makefile.mk
+____________________________________________________________________________
+[ 4232] By: jhi on 1999/09/26 09:53:43
+ Log: From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: Mailing list Perl5 <perl5-porters@perl.org>
+ Subject: [PATCH 5.005_61] teach xsubpp function pointers
+ Date: Sun, 26 Sep 1999 01:36:09 -0400
+ Message-ID: <19990926013609.A21148@monk.mps.ohio-state.edu>
+
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: Mailing list Perl5 <perl5-porters@perl.org>
+ Subject: [PATCH 5.005_61] Make h2xs -x almost bullet-proof
+ Date: Sun, 26 Sep 1999 03:00:50 -0400
+ Message-ID: <19990926030050.A21498@monk.mps.ohio-state.edu>
+ Branch: cfgperl
+ ! lib/ExtUtils/xsubpp utils/h2xs.PL
+____________________________________________________________________________
+[ 4231] By: jhi on 1999/09/26 09:48:49
+ Log: From: "Konovalov, Vadim" <vkonovalov@lucent.com>
+ To: perl5-porters@perl.org
+ Subject: misprint in perlguts
+ Date: Sun, 26 Sep 1999 12:48:36 +0400
+ Message-ID: <402099F49BEED211999700805FC7359F20D7A5@ru0028exch01.spb.lucent.com>
+ Branch: cfgperl
+ ! pod/perlguts.pod
+____________________________________________________________________________
+[ 4230] By: gsar on 1999/09/26 00:50:08
+ Log: add $installarchlib/CORE to default linker search path on windows
+ Branch: perl
+ ! win32/Makefile win32/makefile.mk
+____________________________________________________________________________
+[ 4229] By: gsar on 1999/09/25 20:05:03
+ Log: support C<use Shell> on Windows (reworked a patch suggested
+ by Jenda Krynicky <Jenda@McCann.cz>)
+ Branch: perl
+ ! lib/Shell.pm
+____________________________________________________________________________
+[ 4228] By: gsar on 1999/09/25 07:03:34
+ Log: integrate cfgperl contents into mainline
+ Branch: perl
+ +> hints/svr5.sh
+ !> Configure MANIFEST Makefile.SH config_h.SH hints/sco.sh
+ !> lib/unicode/Eq/Latin1 lib/unicode/Eq/Unicode
+ !> lib/unicode/mktables.PL pod/perldelta.pod pod/perlfaq9.pod
+ !> regcomp.c regexec.c t/lib/syslfs.t t/op/lfs.t
+____________________________________________________________________________
+[ 4227] By: gsar on 1999/09/25 06:44:47
+ Log: From: Larry Wall <larry@wall.org>
+ Date: Fri, 24 Sep 1999 21:59:37 PDT
+ Message-Id: <199909250459.VAA27506@kiev.wall.org>
+ Subject: Re: [PATCH 5.005_61] "our" declarations
+ Branch: perl
+ ! gv.c gv.h intrpvar.h keywords.h keywords.pl op.c
+ ! pod/perldiag.pod pod/perlembed.pod pod/perlfaq3.pod
+ ! pod/perlfaq7.pod pod/perlfunc.pod pod/perlmod.pod
+ ! pod/perlmodlib.pod pod/perlsub.pod pod/perltoot.pod
+ ! pod/perlxstut.pod sv.h t/pragma/strict-vars toke.c
+ ! utils/h2xs.PL
+____________________________________________________________________________
+[ 4226] By: jhi on 1999/09/24 23:10:52
+ Log: Integrate with Sarathy.
+ Branch: cfgperl
+ !> XSUB.h ext/POSIX/POSIX.pod ext/POSIX/POSIX.xs
+ !> ext/POSIX/hints/linux.pl pod/perldiag.pod pod/perlfunc.pod
+ !> pp.c t/lib/posix.t t/op/pack.t toke.c utils/perlcc.PL
+____________________________________________________________________________
+[ 4225] By: gsar on 1999/09/24 18:19:54
+ Log: avoid infinite recursive exec()s of perl.exe when shebang
+ contains "Perl" rather than "perl" on DOSISH platforms
+ Branch: perl
+ ! toke.c
+____________________________________________________________________________
+[ 4224] By: gsar on 1999/09/24 16:09:23
+ Log: support cygwin and other platforms that link to import libraries
+ rather than directly with shared libraries (from a suggestion
+ by Lucian Cionca <Lucian.Cionca@algoritma.ro>)
+ Branch: perl
+ ! utils/perlcc.PL
+____________________________________________________________________________
+[ 4223] By: gsar on 1999/09/24 05:05:06
+ Log: normalize time for strftime() (without the isdst effects of
+ mktime()) using a custom mini_mktime()
+ From: spider-perl@Orb.Nashua.NH.US
+ Date: Thu, 23 Sep 1999 17:54:53 -0400
+ Message-Id: <199909232154.RAA25151@leggy.zk3.dec.com>
+ Subject: Re: [ID 19990913.003] Possible bug using POSIX::strftime Digital UNIX Perl 5.005_03
+ Branch: perl
+ ! ext/POSIX/POSIX.pod ext/POSIX/POSIX.xs
+ ! ext/POSIX/hints/linux.pl t/lib/posix.t
+____________________________________________________________________________
+[ 4222] By: gsar on 1999/09/23 06:44:42
+ Log: change "#" to a comment starter in pack templates; "/" now
+ used for specifying counted types
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Date: Wed, 22 Sep 1999 19:41:30 -0400
+ Message-ID: <19990922194130.A864@monk.mps.ohio-state.edu>
+ Subject: [PATCH 5.005_61] Enable comments in pack()/unpack() templates
+ Branch: perl
+ ! pod/perldiag.pod pod/perlfunc.pod pp.c t/op/pack.t
+____________________________________________________________________________
+[ 4221] By: gsar on 1999/09/23 06:26:54
+ Log: From: Vishal Bhatia <vishal@gol.com>
+ Date: Thu, 23 Sep 1999 12:45:19 +0900 (JST)
+ Message-ID: <Pine.LNX.4.10.9909231218360.3428-100000@localhost.localdomain>
+ Subject: [patch _61] perlcc changes
+ Branch: perl
+ ! utils/perlcc.PL
+____________________________________________________________________________
+[ 4220] By: gsar on 1999/09/23 01:12:24
+ Log: add include guard
+ Branch: perl
+ ! XSUB.h
+____________________________________________________________________________
+[ 4219] By: jhi on 1999/09/22 20:38:15
+ Log: Cleanup cleanup.
+ Branch: cfgperl
+ ! Makefile.SH t/lib/syslfs.t t/op/lfs.t
+____________________________________________________________________________
+[ 4218] By: jhi on 1999/09/22 19:26:58
+ Log: Tweak the equivalence tables once again.
+ Branch: cfgperl
+ ! lib/unicode/Eq/Latin1 lib/unicode/Eq/Unicode
+ ! lib/unicode/mktables.PL
+____________________________________________________________________________
+[ 4215] By: jhi on 1999/09/22 06:47:03
+ Log: From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: Mailing list Perl5 <perl5-porters@perl.org>
+ Subject: [PATCH 5.005_61] regfree could segfault with -Mre=debug
+ Date: Tue, 21 Sep 1999 19:50:00 -0400
+ Message-ID: <19990921195000.A23938@monk.mps.ohio-state.edu>
+
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ To: Mailing list Perl5 <perl5-porters@perl.org>
+ Subject: [PATCH 5.005_61] More verbose -Mre=debug
+ Date: Tue, 21 Sep 1999 22:29:55 -0400
+ Message-ID: <19990921222955.A25094@monk.mps.ohio-state.edu>
+ Branch: cfgperl
+ ! regcomp.c regexec.c
+____________________________________________________________________________
+[ 4214] By: jhi on 1999/09/21 21:08:43
+ Log: From: 0000-Admin (0000) <root@devsys0.zenez.com>
+ Reply-To: gerberb@zenez.com
+ To: perl5-porters@perl.org
+ Subject: [ID 19990921.004] Changes for SCO OpenServer and UnixWare 7
+ Date: Tue, 21 Sep 1999 11:07:46 -0600 (MDT)
+ Message-Id: <199909211707.LAA23611@devsys0.zenez.com>
+
+ (Snipped away the last lines of svr5.sh a la change #3725)
+ Branch: cfgperl
+ + hints/svr5.sh
+ ! Configure MANIFEST config_h.SH hints/sco.sh
+ Branch: metaconfig
+ ! U/modified/Cppsym.U U/modified/Oldconfig.U
+____________________________________________________________________________
+[ 4213] By: jhi on 1999/09/21 20:48:01
+ Log: From: Kragen Sitaker <kragen@dnaco.net>
+ To: perl5-porters@perl.org
+ Subject: [ID 19990921.013] accidental list context in perlfaq9
+ Date: Tue, 21 Sep 1999 16:27:53 -0400 (EDT)
+ Reply-To: kragen@pobox.com
+ Message-Id: <199909212027.QAA03450@kirk.dnaco.net>
+ Branch: cfgperl
+ ! pod/perlfaq9.pod
+____________________________________________________________________________
+[ 4212] By: jhi on 1999/09/20 19:55:42
+ Log: Integrate with Sarathy.
+ Branch: cfgperl
+ +> README.Y2K
+ !> Changes MANIFEST
+____________________________________________________________________________
+[ 4211] By: jhi on 1999/09/20 19:44:44
+ Log: Rename -Duselfs to -Duselargefiles. We don't need no stnkngbbrvtns.
+ Branch: cfgperl
+ ! Configure config_h.SH pod/perldelta.pod
+ Branch: metaconfig/U/perl
+ ! use64bits.U uselfs.U uselongdbl.U
+____________________________________________________________________________
+[ 4210] By: jhi on 1999/09/20 19:38:26
+ Log: Configure -A change: -Afoo=bar is equal to -Aappend:foo=" bar".
+ Branch: cfgperl
+ ! Configure config_h.SH
+ Branch: metaconfig
+ ! U/modified/Options.U
+____________________________________________________________________________
+[ 4209] By: gsar on 1999/09/20 19:35:39
+ Log: integrate cfgperl changes into mainline
+ Branch: perl
+ +> lib/unicode/Unicode.html
+ ! Changes
+ !> Configure Porting/Glossary Porting/config.sh Porting/config_H
+ !> config_h.SH doio.c perl.h pod/perldelta.pod pod/perlfunc.pod
+____________________________________________________________________________
[ 4208] By: gsar on 1999/09/20 18:28:44
Log: add README.Y2K (from Dominic Dunlop <domo@vo.lu>)
Branch: perl
@@ -1261,22 +1741,11 @@ ____________________________________________________________________________
Branch: cfgperl
! toke.c
____________________________________________________________________________
-[ 4058] By: jhi on 1999/08/31 08:57:35
- Log: For some odd reason #4056 didn't undo #3922 completely.
- Branch: cfgperl
- ! pp.c
-____________________________________________________________________________
[ 4057] By: gsar on 1999/08/30 22:08:19
Log: avoid hiding child process window
Branch: perl
! win32/win32.c
____________________________________________________________________________
-[ 4056] By: jhi on 1999/08/30 21:36:24
- Log: Retract #3922 (Rule #1 was invoked).
- (See also #4058).
- Branch: cfgperl
- ! pod/perldiag.pod pp.c regexp.h
-____________________________________________________________________________
[ 4055] By: jhi on 1999/08/30 21:20:50
Log: Document the undefinedness of overshifting.
Branch: cfgperl
@@ -1854,11 +2323,6 @@ ____________________________________________________________________________
Branch: metaconfig/U/perl
! d_dlsymun.U io64.U uselongdbl.U
____________________________________________________________________________
-[ 3981] By: jhi on 1999/08/13 15:11:51
- Log: Retract change #3977 (do_open9() adds O_LARGEFILE automagically).
- Branch: cfgperl
- ! t/lib/syslfs.t
-____________________________________________________________________________
[ 3980] By: jhi on 1999/08/13 15:09:11
Log: Introduce HAS_LLSEEK.
Branch: cfgperl
@@ -1879,11 +2343,6 @@ ____________________________________________________________________________
Branch: cfgperl
! t/op/64bit.t
____________________________________________________________________________
-[ 3977] By: jhi on 1999/08/13 09:56:25
- Log: Use O_LARGEFILE if available.
- Branch: cfgperl
- ! t/lib/syslfs.t
-____________________________________________________________________________
[ 3976] By: jhi on 1999/08/12 21:49:16
Log: IRIX64 needs more -mabi=64 with gcc.
Branch: cfgperl
@@ -2258,18 +2717,6 @@ ____________________________________________________________________________
Branch: cfgperl
! pp.c
____________________________________________________________________________
-[ 3924] By: jhi on 1999/08/05 09:23:00
- Log: Warning fix to change #3922.
- From: paul.marquess@bt.com
- To: ilya@math.ohio-state.edu, gsar@activestate.com
- Cc: tchrist@jhereg.perl.com, chaimf@pobox.com, ed@chronos.net,
- perl5-porters@perl.org
- Subject: RE: [PATCH 5.00557] split /^/
- Date: Thu, 5 Aug 1999 09:01:15 +0100
- Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202D49B23@mbtlipnt02.btlabs.bt.co.uk>
- Branch: cfgperl
- ! pp.c
-____________________________________________________________________________
[ 3923] By: jhi on 1999/08/05 09:16:57
Log: From: paul.marquess@bt.com
To: jhi@iki.fi, paul.marquess@bt.com
@@ -2280,19 +2727,6 @@ ____________________________________________________________________________
Branch: cfgperl
! t/lib/anydbm.t
____________________________________________________________________________
-[ 3922] By: jhi on 1999/08/05 08:09:59
- Log: Deprecate /^/ implictly meaning /^/m.
-
- From: Ilya Zakharevich <ilya@math.ohio-state.edu>
- To: Gurusamy Sarathy <gsar@activestate.com>
- Cc: Tom Christiansen <tchrist@jhereg.perl.com>, chaimf@pobox.com,
- ed@chronos.net, perl5-porters@perl.org
- Subject: [PATCH 5.00557] split /^/
- Date: Wed, 4 Aug 1999 16:46:57 -0400
- Message-ID: <19990804164657.A3776@monk.mps.ohio-state.edu>
- Branch: cfgperl
- ! pod/perldiag.pod pp.c regexp.h
-____________________________________________________________________________
[ 3921] By: jhi on 1999/08/05 08:05:13
Log: From: paul.marquess@bt.com
To: perl5-porters@perl.org
@@ -2376,26 +2810,6 @@ ____________________________________________________________________________
Branch: cfgperl
! t/op/filetest.t
____________________________________________________________________________
-[ 3913] By: jhi on 1999/08/03 21:07:57
- Log: Retract #3912, much too many compilation warnings
- under Digital UNIX.
- Branch: cfgperl
- ! doio.c iperlsys.h perl.h perlio.c perlsdio.h perlsfio.h
- ! pp_sys.c sv.c
-____________________________________________________________________________
-[ 3912] By: jhi on 1999/08/03 20:13:59
- Log: (Retracted). See #3913.
-
- From: Sven Verdoolaege <skimo@kotnet.org>
- To: perl5-porters@perl.org
- Subject: [ID 19990803.003] Not OK: perl 5.00560 on i586-linux-thread
- 2.1.125 [PATCH]
- Date: Tue, 3 Aug 1999 13:14:07 +0200
- Message-Id: <19990803131407.A30911@pool.kotnet.org>
- Branch: cfgperl
- ! doio.c iperlsys.h perl.h perlio.c perlsdio.h perlsfio.h
- ! pp_sys.c sv.c
-____________________________________________________________________________
[ 3911] By: jhi on 1999/08/03 19:52:38
Log: The "-Dusethreads -Duseperlio" combination failed.
diff --git a/MANIFEST b/MANIFEST
index 74ed56c3ba..4ac1ba4def 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -614,9 +614,8 @@ lib/Pod/Functions.pm used by pod/splitpod
lib/Pod/Html.pm Convert POD data to HTML
lib/Pod/InputObjects.pm Pod-Parser - define objects for input streams
lib/Pod/Parser.pm Pod-Parser - define base class for parsing POD
-lib/Pod/PlainText.pm Pod-Parser - convert POD data to formatted ASCII text
lib/Pod/Select.pm Pod-Parser - select portions of POD docs
-lib/Pod/Text.pm Convert POD data to formatted ASCII text
+lib/Pod/Text.pm Pod-Parser - convert POD data to formatted ASCII text
lib/Pod/Text/Color.pm Convert POD data to color ASCII text
lib/Pod/Text/Termcap.pm Convert POD data to ASCII text with format escapes
lib/Pod/Usage.pm Pod-Parser - print usage messages
@@ -1344,14 +1343,20 @@ t/pod/included.t Test =include directive
t/pod/included.xr Expected results for included.t
t/pod/lref.t Test L<...> sequences
t/pod/lref.xr Expected results for lref.t
+t/pod/multiline_items.t Test multiline =items
+t/pod/multiline_items.xr Test multiline =items
t/pod/nested_items.t Test nested =items
t/pod/nested_items.xr Expected results for nested_items.t
t/pod/nested_seqs.t Test nested interior sequences
t/pod/nested_seqs.xr Expected results for nested_seqs.t
t/pod/oneline_cmds.t Test single paragraph ==cmds
t/pod/oneline_cmds.xr Expected results for oneline_cmds.t
+t/pod/pod2usage.t Test Pod::Usage
+t/pod/pod2usage.xr Expected results for pod2usage.t
t/pod/poderrs.t Test POD errors
t/pod/poderrs.xr Expected results for emptycmd.t
+t/pod/podselect.t Test Pod::Select
+t/pod/podselect.xr Expected results for podselect.t
t/pod/special_seqs.t Test "special" interior sequences
t/pod/special_seqs.xr Expected results for emptycmd.t
t/pod/testcmp.pl Module to compare output against expected results
diff --git a/av.c b/av.c
index 509b8972e5..7201b49d8f 100644
--- a/av.c
+++ b/av.c
@@ -637,11 +637,34 @@ Perl_avhv_fetch_ent(pTHX_ AV *av, SV *keysv, I32 lval, U32 hash)
return av_fetch(av, avhv_index_sv(HeVAL(he)), lval);
}
+/* Check for the existence of an element named by a given key.
+ *
+ * This relies on the fact that uninitialized array elements
+ * are set to &PL_sv_undef.
+ */
bool
Perl_avhv_exists_ent(pTHX_ AV *av, SV *keysv, U32 hash)
{
HV *keys = avhv_keys(av);
- return hv_exists_ent(keys, keysv, hash);
+ HE *he;
+ IV ix;
+
+ he = hv_fetch_ent(keys, keysv, FALSE, hash);
+ if (!he || !SvOK(HeVAL(he)))
+ return FALSE;
+
+ ix = SvIV(HeVAL(he));
+
+ /* If the array hasn't been extended to reach the key yet then
+ * it hasn't been accessed and thus does not exist. We use
+ * AvFILL() rather than AvFILLp() to handle tied av. */
+ if (ix > 0 && ix <= AvFILL(av)
+ && (SvRMAGICAL(av)
+ || (AvARRAY(av)[ix] && AvARRAY(av)[ix] != &PL_sv_undef)))
+ {
+ return TRUE;
+ }
+ return FALSE;
}
HE *
diff --git a/configure.com b/configure.com
index 96e86335a7..a9ed05be38 100644
--- a/configure.com
+++ b/configure.com
@@ -1762,27 +1762,6 @@ $ ELSE
$ use_64bit="N"
$ ENDIF
$ ENDIF
-$!
-$! Ask if they want to build with 64-bit support
-$ if (Archname.eqs."VMS_AXP").and.("''f$extract(1,3, f$getsyi(""version""))'".ges."7.1")
-$ THEN
-$ echo "This version of perl has experimental support for building wtih
-$ echo "64 bit integers and 128 bit floating point variables. This gives
-$ echo "a much larger range for perl's mathematical operations. (Note that
-$ echo "does *not* enable 64-bit fileops at the moment, as Dec C doesn't
-$ echo "do that yet)"
-$ echo ""
-$ dflt = use_64bit
-$ rp = "Build with 64 bits? [''dflt'] "
-$ GOSUB myread
-$ if ans.eqs."" then ans = dflt
-$ if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
-$ THEN
-$ use_64bit="Y"
-$ ELSE
-$ use_64bit="N"
-$ ENDIF
-$ ENDIF
$! Ask about threads, if appropriate
$ if (Using_Dec_C.eqs."Yes")
$ THEN
diff --git a/emacs/ptags b/emacs/ptags
index 7570220218..54770a0a14 100755
--- a/emacs/ptags
+++ b/emacs/ptags
@@ -21,7 +21,7 @@ if test ! -z "$OS2_SHELL"; then alias find=gnufind; fi
# Move autogenerated less-informative files to the end:
# Hard to do embed.h and embedvar.h in one sweep:
-topfiles="`echo ' ' *.y *.c *.h ' ' | sed 's/ \(embed\(var\|\)\.h\|obj\(pp\|XSUB\)\.h\|globals\.c\) \(\(embedvar\|objpp\).h \|\)/ /g'`"
+topfiles="`echo ' ' *.y *.c *.h ' ' | sed 's/ / /g' | sed 's/ embedvar\.h\|embed\.h\|obj\(pp\|XSUB\)\.h\|\(globals\|perlapi\)\.c / /g'`"
subdirs="`find ./* -maxdepth 0 -type d`"
subdirfiles="`find $subdirs -name '*.[cy]' -print | sort`"
subdirfiles1="`find $subdirs -name '*.[hH]' -print | sort`"
@@ -74,10 +74,37 @@ perl -w014pe 'if (s/^( .* PERLVAR A?I? # 1: TAG group
}' TAGS.tmp > TAGS.tm1 && mv TAGS.tm1 TAGS.tmp
+# Now remove these Perl_, add empty- and perl_-flavors:
+perl -w014pe 'if (s/^(Perl_ # 1: First group
+ (\w+) \( # 2: Stripped name
+ \x7F # End of description
+ ) # End of description
+ (\d+,\d+\n) # 3: TAGS Trail
+ /$1$3$1$2\x01$3$1perl_$2\x01$3/mgx) { # Repeat, add empty and perl_ flavors
+ $chars = chomp;
+ s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e;
+ $_ .= ("\f" x $chars);
+ }' TAGS.tmp > TAGS.tm1 && mv TAGS.tm1 TAGS.tmp
+
+# Now remove these S_, add empty-flavor:
+perl -w014pe 'if (s/^(S_ # 1: First group
+ (\w+) \( # 2: Stripped name
+ \x7F # End of description
+ ) # End of description
+ (\d+,\d+\n) # 3: TAGS Trail
+ /$1$3$1$2\x01$3/mgx) { # Repeat, add empty_ flavor
+ $chars = chomp;
+ s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e;
+ $_ .= ("\f" x $chars);
+ }' TAGS.tmp > TAGS.tm1 && mv TAGS.tm1 TAGS.tmp
etags -o TAGS.tmp -a -D -l none -r '/#define.*\t\(Perl_.*\)/\1/' embed.h
-etags -o TAGS.tmp -a globals.c embedvar.h objXSUB.h objpp.h
+etags -o TAGS.tmp -a globals.c embedvar.h objXSUB.h perlapi.c
+# The above processes created a lot of descriptions with an
+# an explicitly specified tag. Such descriptions have higher
+# precedence than descriptions without an explicitely specified tag.
+# To restore the justice, make all the descriptions explicit.
perl -w014pe 'if (s/^( [^\n\x7F\x01]*\b # 1: TAG group
(\w+) # 2: word
[^\w\x7F\x01\n]* # Most anything
diff --git a/ext/attrs/attrs.pm b/ext/attrs/attrs.pm
index e97fa1ee39..cec5ea5fcd 100644
--- a/ext/attrs/attrs.pm
+++ b/ext/attrs/attrs.pm
@@ -8,7 +8,7 @@ $VERSION = "1.0";
=head1 NAME
-attrs - set/get attributes of a subroutine
+attrs - set/get attributes of a subroutine (deprecated)
=head1 SYNOPSIS
@@ -21,11 +21,17 @@ attrs - set/get attributes of a subroutine
=head1 DESCRIPTION
-This module lets you set and get attributes for subroutines.
+NOTE: Use of this pragma is deprecated. Use the syntax
+
+ sub foo : locked, method { }
+
+to declare attributes instead. See also L<attributes>.
+
+This pragma lets you set and get attributes for subroutines.
Setting attributes takes place at compile time; trying to set
invalid attribute names causes a compile-time error. Calling
-C<attr::get> on a subroutine reference or name returns its list
-of attribute names. Notice that C<attr::get> is not exported.
+C<attrs::get> on a subroutine reference or name returns its list
+of attribute names. Notice that C<attrs::get> is not exported.
Valid attributes are as follows.
=over
@@ -46,11 +52,6 @@ execution. The semantics of the lock are exactly those of one
explicitly taken with the C<lock> operator immediately after the
subroutine is entered.
-=item lvalue
-
-Setting this attribute enables the subroutine to be used in
-lvalue context. See L<perlsub/"Lvalue subroutines">.
-
=back
=cut
diff --git a/ext/attrs/attrs.xs b/ext/attrs/attrs.xs
index a92922d497..4c00cd7cb2 100644
--- a/ext/attrs/attrs.xs
+++ b/ext/attrs/attrs.xs
@@ -10,8 +10,6 @@ get_flag(char *attr)
return CVf_METHOD;
else if (strnEQ(attr, "locked", 6))
return CVf_LOCKED;
- else if (strnEQ(attr, "lvalue", 6))
- return CVf_LVALUE;
else
return 0;
}
@@ -29,6 +27,10 @@ char * Class
PPCODE:
if (!PL_compcv || !(cv = CvOUTSIDE(PL_compcv)))
croak("can't set attributes outside a subroutine scope");
+ if (ckWARN(WARN_DEPRECATED))
+ Perl_warner(aTHX_ WARN_DEPRECATED,
+ "pragma \"attrs\" is deprecated, "
+ "use \"sub NAME : ATTRS\" instead");
for (i = 1; i < items; i++) {
STRLEN n_a;
char *attr = SvPV(ST(i), n_a);
diff --git a/lib/Pod/Checker.pm b/lib/Pod/Checker.pm
index 6607ad9375..8f6d1d17f9 100644
--- a/lib/Pod/Checker.pm
+++ b/lib/Pod/Checker.pm
@@ -1,10 +1,7 @@
#############################################################################
# Pod/Checker.pm -- check pod documents for syntax errors
#
-# Based on Tom Christiansen's Pod::Text::pod2text() function
-# (with modifications).
-#
-# Copyright (C) 1994-1999 Tom Christiansen. All rights reserved.
+# Copyright (C) 1994-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
@@ -13,7 +10,7 @@
package Pod::Checker;
use vars qw($VERSION);
-$VERSION = 1.081; ## Current version of this package
+$VERSION = 1.085; ## Current version of this package
require 5.004; ## requires this Perl version or later
=head1 NAME
@@ -140,7 +137,27 @@ sub new {
sub initialize {
my $self = shift;
- $self->num_errors(0);
+ ## Initialize number of errors, and setup an error function to
+ ## increment this number and then print to the designated output.
+ $self->{_NUM_ERRORS} = 0;
+ $self->errorsub('poderror');
+}
+
+## Invoked as $self->poderror( @args ), or $self->poderror( {%opts}, @args )
+sub poderror {
+ my $self = shift;
+ my %opts = (ref $_[0]) ? %{shift()} : ();
+
+ ## Retrieve options
+ chomp( my $msg = ($opts{-msg} || "")."@_" );
+ my $line = (exists $opts{-line}) ? " at line $opts{-line}" : "";
+ my $file = (exists $opts{-file}) ? " in file $opts{-file}" : "";
+ my $severity = (exists $opts{-severity}) ? "*** $opts{-severity}: " : "";
+
+ ## Increment error count and print message
+ ++($self->{_NUM_ERRORS});
+ my $out_fh = $self->output_handle();
+ print $out_fh ($severity, $msg, $line, $file, "\n");
}
sub num_errors {
@@ -164,18 +181,16 @@ sub end_pod {
}
sub command {
- my ($self, $command, $paragraph, $line_num, $pod_para) = @_;
+ my ($self, $cmd, $paragraph, $line_num, $pod_para) = @_;
my ($file, $line) = $pod_para->file_line;
- my $out_fh = $self->output_handle();
## Check the command syntax
- if (! $VALID_COMMANDS{$command}) {
- ++($self->{_NUM_ERRORS});
- _invalid_cmd($out_fh, $command, $paragraph, $file, $line);
+ if (! $VALID_COMMANDS{$cmd}) {
+ $self->poderror({ -line => $line, -file => $file, -severity => 'ERROR',
+ -msg => "Unknown command \"$cmd\"" });
}
else {
## check syntax of particular command
}
- ## Check the interior sequences in the command-text
my $expansion = $self->interpolate($paragraph, $line_num);
}
@@ -186,39 +201,19 @@ sub verbatim {
sub textblock {
my ($self, $paragraph, $line_num, $pod_para) = @_;
- my $out_fh = $self->output_handle();
- ## Check the interior sequences in the text (set $SIG{__WARN__} to
- ## send parse_text warnings about untermnated sequences to $out_fh)
- local $SIG{__WARN__} = sub {
- ++($self->{_NUM_ERRORS});
- print $out_fh @_
- };
my $expansion = $self->interpolate($paragraph, $line_num);
}
sub interior_sequence {
my ($self, $seq_cmd, $seq_arg, $pod_seq) = @_;
my ($file, $line) = $pod_seq->file_line;
- my $out_fh = $self->output_handle();
## Check the sequence syntax
if (! $VALID_SEQUENCES{$seq_cmd}) {
- ++($self->{_NUM_ERRORS});
- _invalid_seq($out_fh, $seq_cmd, $seq_arg, $file, $line);
+ $self->poderror({ -line => $line, -file => $file, -severity => 'ERROR',
+ -msg => "Unknown interior-sequence \"$seq_cmd\"" });
}
else {
## check syntax of the particular sequence
}
}
-sub _invalid_cmd {
- my ($fh, $cmd, $text, $file, $line) = @_;
- print $fh "*** ERROR: Unknown command \"$cmd\""
- . " at line $line of file $file\n";
-}
-
-sub _invalid_seq {
- my ($fh, $cmd, $text, $file, $line) = @_;
- print $fh "*** ERROR: Unknown interior-sequence \"$cmd\""
- . " at line $line of file $file\n";
-}
-
diff --git a/lib/Pod/InputObjects.pm b/lib/Pod/InputObjects.pm
index 007fd74ebc..f7231e596c 100644
--- a/lib/Pod/InputObjects.pm
+++ b/lib/Pod/InputObjects.pm
@@ -2,7 +2,7 @@
# Pod/InputObjects.pm -- package which defines objects for input streams
# and paragraphs and commands when parsing POD docs.
#
-# Copyright (C) 1996-1999 Tom Christiansen. All rights reserved.
+# Copyright (C) 1996-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
@@ -11,7 +11,7 @@
package Pod::InputObjects;
use vars qw($VERSION);
-$VERSION = 1.081; ## Current version of this package
+$VERSION = 1.085; ## Current version of this package
require 5.004; ## requires this Perl version or later
#############################################################################
@@ -434,6 +434,9 @@ It has the following methods/attributes:
-file => $filename,
-line => $line_number);
+ my $pod_seq4 = new Pod::InteriorSequence(-name => $cmd, $ptree);
+ my $pod_seq5 = new Pod::InteriorSequence($cmd, $ptree);
+
This is a class method that constructs a C<Pod::InteriorSequence> object
and returns a reference to the new interior sequence object. It should
be given two keyword arguments. The C<-ldelim> keyword indicates the
@@ -441,7 +444,10 @@ corresponding left-delimiter of the interior sequence (e.g. 'E<lt>').
The C<-name> keyword indicates the name of the corresponding interior
sequence command, such as C<I> or C<B> or C<C>. The C<-file> and
C<-line> keywords indicate the filename and line number corresponding
-to the beginning of the interior sequence.
+to the beginning of the interior sequence. If the C<$ptree> argument is
+given, it must be the last argument, and it must be either string, or
+else an array-ref suitable for passing to B<Pod::ParseTree::new> (or
+it may be a reference to an Pod::ParseTree object).
=cut
@@ -450,6 +456,18 @@ sub new {
my $this = shift;
my $class = ref($this) || $this;
+ ## See if first argument has no keyword
+ if (((@_ <= 2) or (@_ % 2)) and $_[0] !~ /^-\w/) {
+ ## Yup - need an implicit '-name' before first parameter
+ unshift @_, '-name';
+ }
+
+ ## See if odd number of args
+ if ((@_ % 2) != 0) {
+ ## Yup - need an implicit '-ptree' before the last parameter
+ splice @_, $#_, 0, '-ptree';
+ }
+
## Any remaining arguments are treated as initial values for the
## hash that is used to represent this object. Note that we default
## certain values by specifying them *before* the arguments passed.
@@ -460,10 +478,18 @@ sub new {
-line => 0,
-ldelim => '<',
-rdelim => '>',
- -ptree => new Pod::ParseTree(),
@_
};
+ ## Initialize contents if they havent been already
+ my $ptree = $self->{'-ptree'} || new Pod::ParseTree();
+ if ( ref $ptree =~ /^(ARRAY)?$/ ) {
+ ## We have an array-ref, or a normal scalar. Pass it as an
+ ## an argument to the ptree-constructor
+ $ptree = new Pod::ParseTree($1 ? [$ptree] : $ptree);
+ }
+ $self->{'-ptree'} = $ptree;
+
## Bless ourselves into the desired class and perform any initialization
bless $self, $class;
return $self;
@@ -496,7 +522,7 @@ sub _set_child2parent_links {
my ($self, @children) = @_;
## Make sure any sequences know who their parent is
for (@children) {
- next unless ref;
+ next unless (ref || ref eq 'SCALAR');
if ($_->isa('Pod::InteriorSequence') or $_->can('nested')) {
$_->nested($self);
}
@@ -510,8 +536,8 @@ sub _unset_child2parent_links {
$self->{'-parent_sequence'} = undef;
my $ptree = $self->{'-ptree'};
for (@$ptree) {
- next unless (length and ref and $_->isa('Pod::InteriorSequence'));
- $_->_unset_child2parent_links();
+ next unless (length and ref and ref ne 'SCALAR');
+ $_->_unset_child2parent_links() if $_->isa('Pod::InteriorSequence');
}
}
@@ -718,7 +744,7 @@ itself contain a parse-tree (since interior sequences may be nested).
This is a class method that constructs a C<Pod::Parse_tree> object and
returns a reference to the new parse-tree. If a single-argument is given,
-it mist be a reference to an array, and is used to initialize the root
+it must be a reference to an array, and is used to initialize the root
(top) of the parse tree.
=cut
@@ -863,8 +889,8 @@ sub _unset_child2parent_links {
my $self = shift;
local *ptree = $self;
for (@ptree) {
- next unless (length and ref and $_->isa('Pod::InteriorSequence'));
- $_->_unset_child2parent_links();
+ next unless (length and ref and ref ne 'SCALAR');
+ $_->_unset_child2parent_links() if $_->isa('Pod::InteriorSequence');
}
}
diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
new file mode 100644
index 0000000000..7a1c69f5a9
--- /dev/null
+++ b/lib/Pod/Man.pm
@@ -0,0 +1,1185 @@
+# Pod::Man -- Convert POD data to formatted *roff input.
+# $Id: Man.pm,v 0.5 1999/09/25 19:49:49 eagle Exp $
+#
+# Copyright 1999 by Russ Allbery <rra@stanford.edu>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the same terms as Perl itself.
+#
+# This module is intended to be a replacement for pod2man, and attempts to
+# match its output except for some specific circumstances where other
+# decisions seemed to produce better output. It uses Pod::Parser and is
+# designed to be very easy to subclass.
+
+############################################################################
+# Modules and declarations
+############################################################################
+
+package Pod::Man;
+
+require 5.004;
+
+use Carp qw(carp croak);
+use Pod::Parser ();
+
+use strict;
+use subs qw(makespace);
+use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION);
+
+@ISA = qw(Pod::Parser);
+
+($VERSION = (split (' ', q$Revision: 0.5 $ ))[1]) =~ s/\.(\d)$/.0$1/;
+
+
+############################################################################
+# Preamble and *roff output tables
+############################################################################
+
+# The following is the static preamble which starts all *roff output we
+# generate. It's completely static except for the font to use as a
+# fixed-width font, which is designed by @CFONT@. $PREAMBLE should
+# therefore be run through s/\@CFONT\@/<font>/g before output.
+$PREAMBLE = <<'----END OF PREAMBLE----';
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.de Vb \" Begin verbatim text
+.ft @CFONT@
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
+.\" to do unbreakable dashes and therefore won't be available. \*(C` and
+.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` `
+. ds C' '
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
+.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
+.\" index entries marked with X<> in POD. Of course, you'll have to process
+.\" the output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+. .
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it
+.\" makes way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+.bd B 3
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+----END OF PREAMBLE----
+
+# This table is taken nearly verbatim from Tom Christiansen's pod2man. It
+# assumes that the standard preamble has already been printed, since that's
+# what defines all of the accent marks. Note that some of these are quoted
+# with double quotes since they contain embedded single quotes, so use \\
+# uniformly for backslash for readability.
+%ESCAPES = (
+ 'amp' => '&', # ampersand
+ 'lt' => '<', # left chevron, less-than
+ 'gt' => '>', # right chevron, greater-than
+ 'quot' => '"', # double quote
+
+ 'Aacute' => "A\\*'", # capital A, acute accent
+ 'aacute' => "a\\*'", # small a, acute accent
+ 'Acirc' => 'A\\*^', # capital A, circumflex accent
+ 'acirc' => 'a\\*^', # small a, circumflex accent
+ 'AElig' => '\*(AE', # capital AE diphthong (ligature)
+ 'aelig' => '\*(ae', # small ae diphthong (ligature)
+ 'Agrave' => "A\\*`", # capital A, grave accent
+ 'agrave' => "A\\*`", # small a, grave accent
+ 'Aring' => 'A\\*o', # capital A, ring
+ 'aring' => 'a\\*o', # small a, ring
+ 'Atilde' => 'A\\*~', # capital A, tilde
+ 'atilde' => 'a\\*~', # small a, tilde
+ 'Auml' => 'A\\*:', # capital A, dieresis or umlaut mark
+ 'auml' => 'a\\*:', # small a, dieresis or umlaut mark
+ 'Ccedil' => 'C\\*,', # capital C, cedilla
+ 'ccedil' => 'c\\*,', # small c, cedilla
+ 'Eacute' => "E\\*'", # capital E, acute accent
+ 'eacute' => "e\\*'", # small e, acute accent
+ 'Ecirc' => 'E\\*^', # capital E, circumflex accent
+ 'ecirc' => 'e\\*^', # small e, circumflex accent
+ 'Egrave' => 'E\\*`', # capital E, grave accent
+ 'egrave' => 'e\\*`', # small e, grave accent
+ 'ETH' => '\\*(D-', # capital Eth, Icelandic
+ 'eth' => '\\*(d-', # small eth, Icelandic
+ 'Euml' => 'E\\*:', # capital E, dieresis or umlaut mark
+ 'euml' => 'e\\*:', # small e, dieresis or umlaut mark
+ 'Iacute' => "I\\*'", # capital I, acute accent
+ 'iacute' => "i\\*'", # small i, acute accent
+ 'Icirc' => 'I\\*^', # capital I, circumflex accent
+ 'icirc' => 'i\\*^', # small i, circumflex accent
+ 'Igrave' => 'I\\*`', # capital I, grave accent
+ 'igrave' => 'i\\*`', # small i, grave accent
+ 'Iuml' => 'I\\*:', # capital I, dieresis or umlaut mark
+ 'iuml' => 'i\\*:', # small i, dieresis or umlaut mark
+ 'Ntilde' => 'N\*~', # capital N, tilde
+ 'ntilde' => 'n\*~', # small n, tilde
+ 'Oacute' => "O\\*'", # capital O, acute accent
+ 'oacute' => "o\\*'", # small o, acute accent
+ 'Ocirc' => 'O\\*^', # capital O, circumflex accent
+ 'ocirc' => 'o\\*^', # small o, circumflex accent
+ 'Ograve' => 'O\\*`', # capital O, grave accent
+ 'ograve' => 'o\\*`', # small o, grave accent
+ 'Oslash' => 'O\\*/', # capital O, slash
+ 'oslash' => 'o\\*/', # small o, slash
+ 'Otilde' => 'O\\*~', # capital O, tilde
+ 'otilde' => 'o\\*~', # small o, tilde
+ 'Ouml' => 'O\\*:', # capital O, dieresis or umlaut mark
+ 'ouml' => 'o\\*:', # small o, dieresis or umlaut mark
+ 'szlig' => '\*8', # small sharp s, German (sz ligature)
+ 'THORN' => '\\*(Th', # capital THORN, Icelandic
+ 'thorn' => '\\*(th', # small thorn, Icelandic
+ 'Uacute' => "U\\*'", # capital U, acute accent
+ 'uacute' => "u\\*'", # small u, acute accent
+ 'Ucirc' => 'U\\*^', # capital U, circumflex accent
+ 'ucirc' => 'u\\*^', # small u, circumflex accent
+ 'Ugrave' => 'U\\*`', # capital U, grave accent
+ 'ugrave' => 'u\\*`', # small u, grave accent
+ 'Uuml' => 'U\\*:', # capital U, dieresis or umlaut mark
+ 'uuml' => 'u\\*:', # small u, dieresis or umlaut mark
+ 'Yacute' => "Y\\*'", # capital Y, acute accent
+ 'yacute' => "y\\*'", # small y, acute accent
+ 'yuml' => 'y\\*:', # small y, dieresis or umlaut mark
+);
+
+
+############################################################################
+# Static helper functions
+############################################################################
+
+# Protect leading quotes and periods against interpretation as commands.
+sub protect { local $_ = shift; s/^([.\'])/\\&$1/mg; $_ }
+
+# Given a command and a single argument that may or may not contain double
+# quotes, handle double-quote formatting for it. If there are no double
+# quotes, just return the command followed by the argument in double quotes.
+# If there are double quotes, use an if statement to test for nroff, and for
+# nroff output the command followed by the argument in double quotes with
+# embedded double quotes doubled. For other formatters, remap paired double
+# quotes to `` and ''.
+sub switchquotes {
+ my $command = shift;
+ local $_ = shift;
+ my $extra = shift;
+ s/\\\*\([LR]\"/\"/g;
+ if (/\"/) {
+ s/\"/\"\"/g;
+ my $troff = $_;
+ $troff =~ s/\"\"([^\"]*)\"\"/\`\`$1\'\'/g;
+ s/\"/\"\"/g if $extra;
+ $troff =~ s/\"/\"\"/g if $extra;
+ $_ = qq("$_") . ($extra ? " $extra" : '');
+ $troff = qq("$troff") . ($extra ? " $extra" : '');
+ return ".if n $command $_\n.el $command $troff\n";
+ } else {
+ $_ = qq("$_") . ($extra ? " $extra" : '');
+ return "$command $_\n";
+ }
+}
+
+# Translate a font string into an escape.
+sub toescape { (length ($_[0]) > 1 ? '\f(' : '\f') . $_[0] }
+
+
+############################################################################
+# Initialization
+############################################################################
+
+# Initialize the object. Here, we also process any additional options
+# passed to the constructor or set up defaults if none were given. center
+# is the centered title, release is the version number, and date is the date
+# for the documentation. Note that we can't know what file name we're
+# processing due to the architecture of Pod::Parser, so that *has* to either
+# be passed to the constructor or set separately with Pod::Man::name().
+sub initialize {
+ my $self = shift;
+
+ # Figure out the fixed-width font. If user-supplied, make sure that
+ # they are the right length.
+ for (qw/fixed fixedbold fixeditalic fixedbolditalic/) {
+ if (defined $$self{$_}) {
+ if (length ($$self{$_}) < 1 || length ($$self{$_}) > 2) {
+ croak "roff font should be 1 or 2 chars, not `$$self{$_}'";
+ }
+ } else {
+ $$self{$_} = '';
+ }
+ }
+
+ # Set the default fonts. We can't be sure what fixed bold-italic is
+ # going to be called, so default to just bold.
+ $$self{fixed} ||= 'CW';
+ $$self{fixedbold} ||= 'CB';
+ $$self{fixeditalic} ||= 'CI';
+ $$self{fixedbolditalic} ||= 'CB';
+
+ # Set up a table of font escapes. First number is fixed-width, second
+ # is bold, third is italic.
+ $$self{FONTS} = { '000' => '\fR', '001' => '\fI',
+ '010' => '\fB', '011' => '\f(BI',
+ '100' => toescape ($$self{fixed}),
+ '101' => toescape ($$self{fixeditalic}),
+ '110' => toescape ($$self{fixedbold}),
+ '111' => toescape ($$self{fixedbolditalic})};
+
+ # Extra stuff for page titles.
+ $$self{center} = 'User Contributed Perl Documentation'
+ unless defined $$self{center};
+ $$self{indent} = 4 unless defined $$self{indent};
+
+ # We used to try first to get the version number from a local binary,
+ # but we shouldn't need that any more. Get the version from the running
+ # Perl.
+ if (!defined $$self{release}) {
+ my ($version, $patch) = ($] =~ /^(.{5})(\d{2})?/);
+ $$self{release} = "perl $version";
+ $$self{release} .= ", patch $patch" if $patch;
+ }
+
+ # Double quotes in things that will be quoted.
+ for (qw/center date release/) { $$self{$_} =~ s/\"/\"\"/g }
+
+ $$self{INDENT} = 0; # Current indentation level.
+ $$self{INDENTS} = []; # Stack of indentations.
+ $$self{INDEX} = []; # Index keys waiting to be printed.
+
+ $self->SUPER::initialize;
+}
+
+# For each document we process, output the preamble first. Note that the
+# fixed width font is a global default; once we interpolate it into the
+# PREAMBLE, it ain't ever changing. Maybe fix this later.
+sub begin_pod {
+ my $self = shift;
+
+ # Try to figure out the name and section from the file name.
+ my $section = $$self{section} || 1;
+ my $name = $$self{name};
+ if (!defined $name) {
+ $name = $self->input_file;
+ $section = 3 if (!$$self{section} && $name =~ /\.pm$/i);
+ $name =~ s/\.p(od|[lm])$//i;
+ if ($section =~ /^1/) {
+ require File::Basename;
+ $name = uc File::Basename::basename ($name);
+ } else {
+ # Lose everything up to the first of
+ # */lib/*perl* standard or site_perl module
+ # */*perl*/lib from -D prefix=/opt/perl
+ # */*perl*/ random module hierarchy
+ # which works. Should be fixed to use File::Spec.
+ for ($name) {
+ s%//+%/%g;
+ if ( s%^.*?/lib/[^/]*perl[^/]*/%%i
+ or s%^.*?/[^/]*perl[^/]*/(?:lib/)?%%i) {
+ s%^site(_perl)?/%%; # site and site_perl
+ s%^(.*-$^O|$^O-.*)/%%o; # arch
+ s%^\d+\.\d+%%; # version
+ }
+ s%/%::%g;
+ }
+ }
+ }
+
+ # Modification date header. Try to use the modification time of our
+ # input.
+ if (!defined $$self{date}) {
+ my $time = (stat $self->input_file)[9] || time;
+ my ($day, $month, $year) = (localtime $time)[3,4,5];
+ $month++;
+ $year += 1900;
+ $$self{date} = join ('-', $year, $month, $day);
+ }
+
+ # Now, print out the preamble and the title.
+ $PREAMBLE =~ s/\@CFONT\@/$$self{fixed}/;
+ chomp $PREAMBLE;
+ print { $self->output_handle } <<"----END OF HEADER----";
+.\\" Automatically generated by Pod::Man version $VERSION
+.\\" @{[ scalar localtime ]}
+.\\"
+.\\" Standard preamble:
+.\\" ======================================================================
+$PREAMBLE
+.\\" ======================================================================
+.\\"
+.IX Title "$name $section"
+.TH $name $section "$$self{release}" "$$self{date}" "$$self{center}"
+.UC
+----END OF HEADER----
+#"# for cperl-mode
+
+ # Initialize a few per-file variables.
+ $$self{INDENT} = 0;
+ $$self{NEEDSPACE} = 0;
+}
+
+
+############################################################################
+# Core overrides
+############################################################################
+
+# Called for each command paragraph. Gets the command, the associated
+# paragraph, the line number, and a Pod::Paragraph object. Just dispatches
+# the command to a method named the same as the command. =cut is handled
+# internally by Pod::Parser.
+sub command {
+ my $self = shift;
+ my $command = shift;
+ return if $command eq 'pod';
+ return if ($$self{EXCLUDE} && $command ne 'end');
+ $command = 'cmd_' . $command;
+ $self->$command (@_);
+}
+
+# Called for a verbatim paragraph. Gets the paragraph, the line number, and
+# a Pod::Paragraph object. Rofficate backslashes, untabify, put a
+# zero-width character at the beginning of each line to protect against
+# commands, and wrap in .Vb/.Ve.
+sub verbatim {
+ my $self = shift;
+ return if $$self{EXCLUDE};
+ local $_ = shift;
+ return if /^\s+$/;
+ s/\s+$/\n/;
+ my $lines = tr/\n/\n/;
+ 1 while s/^(.*?)(\t+)/$1 . ' ' x (length ($2) * 8 - length ($1) % 8)/me;
+ s/\\/\\e/g;
+ s/^(\s*\S)/'\&' . $1/gme;
+ $self->makespace if $$self{NEEDSPACE};
+ $self->output (".Vb $lines\n$_.Ve\n");
+ $$self{NEEDSPACE} = 0;
+}
+
+# Called for a regular text block. Gets the paragraph, the line number, and
+# a Pod::Paragraph object. Perform interpolation and output the results.
+sub textblock {
+ my $self = shift;
+ return if $$self{EXCLUDE};
+ $self->output ($_[0]), return if $$self{VERBATIM};
+
+ # Perform a little magic to collapse multiple L<> references. We'll
+ # just rewrite the whole thing into actual text at this part, bypassing
+ # the whole internal sequence parsing thing.
+ s{
+ (L< # A link of the form L</something>.
+ /
+ (
+ [:\w]+ # The item has to be a simple word...
+ (\(\))? # ...or simple function.
+ )
+ >
+ (
+ ,?\s+(and\s+)? # Allow lots of them, conjuncted.
+ L<
+ /
+ ( [:\w]+ ( \(\) )? )
+ >
+ )+
+ )
+ } {
+ local $_ = $1;
+ s{ L< / ([^>]+ ) } {$1}g;
+ my @items = split /(?:,?\s+(?:and\s+)?)/;
+ my $string = "the ";
+ my $i;
+ for ($i = 0; $i < @items; $i++) {
+ $string .= $items[$i];
+ $string .= ", " if @items > 2 && $i != $#items;
+ $string .= " and " if ($i == $#items - 1);
+ }
+ $string .= " entries elsewhere in this document";
+ $string;
+ }gex;
+
+ # Parse the tree and output it. collapse knows about references to
+ # scalars as well as scalars and does the right thing with them.
+ local $_ = $self->parse (@_);
+ s/\n\s*$/\n/;
+ $self->makespace if $$self{NEEDSPACE};
+ $self->output (protect $self->mapfonts ($_));
+ $self->outindex;
+ $$self{NEEDSPACE} = 1;
+}
+
+# Called for an interior sequence. Takes a Pod::InteriorSequence object and
+# returns a reference to a scalar. This scalar is the final formatted text.
+# It's returned as a reference so that other interior sequences above us
+# know that the text has already been processed.
+sub sequence {
+ my ($self, $seq) = @_;
+ my $command = $seq->cmd_name;
+
+ # Zero-width characters.
+ if ($command eq 'Z') { return bless \ '\&', 'Pod::Man::String' }
+
+ # C<>, L<>, X<>, and E<> don't apply guesswork to their contents.
+ local $_ = $self->collapse ($seq->parse_tree, $command =~ /^[CELX]$/);
+
+ # Handle E<> escapes.
+ if ($command eq 'E') {
+ if (exists $ESCAPES{$_}) {
+ return bless \ "$ESCAPES{$_}", 'Pod::Man::String';
+ } else {
+ carp "Unknown escape E<$1>";
+ return bless \ "E<$_>", 'Pod::Man::String';
+ }
+ }
+
+ # For all the other sequences, empty content produces no output.
+ return '' if $_ eq '';
+
+ # Handle formatting sequences.
+ if ($command eq 'B') {
+ return bless \ ('\f(BS' . $_ . '\f(BE'), 'Pod::Man::String';
+ } elsif ($command eq 'F') {
+ return bless \ ('\f(IS' . $_ . '\f(IE'), 'Pod::Man::String';
+ } 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';
+ }
+
+ # Handle links.
+ if ($command eq 'L') {
+ return bless \ ($self->buildlink ($_)), 'Pod::Man::String';
+ }
+
+ # Whitespace protection replaces whitespace with "\ ".
+ if ($command eq 'S') {
+ s/\s+/\\ /g;
+ return bless \ "$_", 'Pod::Man::String';
+ }
+
+ # Add an index entry to the list of ones waiting to be output.
+ if ($command eq 'X') { push (@{ $$self{INDEX} }, $_); return '' }
+
+ # Anything else is unknown.
+ carp "Unknown sequence $command<$_>";
+}
+
+
+############################################################################
+# Command paragraphs
+############################################################################
+
+# All command paragraphs take the paragraph and the line number.
+
+# First level heading. We can't output .IX in the NAME section due to a bug
+# in some versions of catman, so don't output a .IX for that section. .SH
+# already uses small caps, so remove any E<> sequences that would cause
+# them.
+sub cmd_head1 {
+ my $self = shift;
+ local $_ = $self->parse (@_);
+ s/\s+$//;
+ s/\\s-?\d//g;
+ $self->output (switchquotes ('.SH', $self->mapfonts ($_)));
+ $self->outindex (($_ eq 'NAME') ? () : ('Header', $_));
+ $$self{NEEDSPACE} = 0;
+}
+
+# Second level heading.
+sub cmd_head2 {
+ my $self = shift;
+ local $_ = $self->parse (@_);
+ s/\s+$//;
+ $self->output (switchquotes ('.Sh', $self->mapfonts ($_)));
+ $self->outindex ('Subsection', $_);
+ $$self{NEEDSPACE} = 0;
+}
+
+# Start a list. For indents after the first, wrap the outside indent in .RS
+# so that hanging paragraph tags will be correct.
+sub cmd_over {
+ my $self = shift;
+ local $_ = shift;
+ unless (/^[-+]?\d+\s+$/) { $_ = $$self{indent} }
+ if (@{ $$self{INDENTS} } > 0) {
+ $self->output (".RS $$self{INDENT}\n");
+ }
+ push (@{ $$self{INDENTS} }, $$self{INDENT});
+ $$self{INDENT} = ($_ + 0);
+}
+
+# End a list. If we've closed an embedded indent, we've mangled the hanging
+# paragraph indent, so temporarily replace it with .RS and set WEIRDINDENT.
+# We'll close that .RS at the next =back or =item.
+sub cmd_back {
+ my $self = shift;
+ $$self{INDENT} = pop @{ $$self{INDENTS} };
+ unless (defined $$self{INDENT}) {
+ carp "Unmatched =back";
+ $$self{INDENT} = 0;
+ }
+ if ($$self{WEIRDINDENT}) {
+ $self->output (".RE\n");
+ $$self{WEIRDINDENT} = 0;
+ }
+ if (@{ $$self{INDENTS} } > 0) {
+ $self->output (".RE\n");
+ $self->output (".RS $$self{INDENT}\n");
+ $$self{WEIRDINDENT} = 1;
+ }
+ $$self{NEEDSPACE} = 1;
+}
+
+# An individual list item. Emit an index entry for anything that's
+# interesting, but don't emit index entries for things like bullets and
+# numbers. rofficate bullets too while we're at it (so for nice output, use
+# * for your lists rather than o or . or - or some other thing).
+sub cmd_item {
+ my $self = shift;
+ local $_ = $self->parse (@_);
+ s/\s+$//;
+ my $index;
+ if (/\w/ && !/^\w[.\)]\s*$/) {
+ $index = $_;
+ $index =~ s/^\s*[-*+o.]?\s*//;
+ }
+ s/^\*(\s|\Z)/\\\(bu$1/;
+ if ($$self{WEIRDINDENT}) {
+ $self->output (".RE\n");
+ $$self{WEIRDINDENT} = 0;
+ }
+ $_ = $self->mapfonts ($_);
+ $self->output (switchquotes ('.Ip', $_, $$self{INDENT}));
+ $self->outindex ($index ? ('Item', $index) : ());
+ $$self{NEEDSPACE} = 0;
+}
+
+# Begin a block for a particular translator. Setting VERBATIM triggers
+# special handling in textblock().
+sub cmd_begin {
+ my $self = shift;
+ local $_ = shift;
+ my ($kind) = /^(\S+)/ or return;
+ if ($kind eq 'man' || $kind eq 'roff') {
+ $$self{VERBATIM} = 1;
+ } else {
+ $$self{EXCLUDE} = 1;
+ }
+}
+
+# End a block for a particular translator. We assume that all =begin/=end
+# pairs are properly closed.
+sub cmd_end {
+ my $self = shift;
+ $$self{EXCLUDE} = 0;
+ $$self{VERBATIM} = 0;
+}
+
+# One paragraph for a particular translator. Ignore it unless it's intended
+# for man or roff, in which case we output it verbatim.
+sub cmd_for {
+ my $self = shift;
+ local $_ = shift;
+ my $line = shift;
+ return unless s/^(?:man|roff)\b[ \t]*\n?//;
+ $self->output ($_);
+}
+
+
+############################################################################
+# Link handling
+############################################################################
+
+# Handle links. We can't actually make real hyperlinks, so this is all to
+# figure out what text and formatting we print out.
+sub buildlink {
+ my $self = shift;
+ local $_ = shift;
+
+ # Smash whitespace in case we were split across multiple lines.
+ s/\s+/ /g;
+
+ # If we were given any explicit text, just output it.
+ if (m{ ^ ([^|]+) \| }x) { return $1 }
+
+ # Okay, leading and trailing whitespace isn't important.
+ s/^\s+//;
+ s/\s+$//;
+
+ # Default to using the whole content of the link entry as a section
+ # name. Note that L<manpage/> forces a manpage interpretation, as does
+ # something looking like L<manpage(section)>. Do the same thing to
+ # L<manpage(section)> as we would to manpage(section) without the L<>;
+ # see guesswork(). If we've added italics, don't add the "manpage"
+ # text; markup is sufficient.
+ my ($manpage, $section) = ('', $_);
+ if (/^"\s*(.*?)\s*"$/) {
+ $section = '"' . $1 . '"';
+ } elsif (m{ ^ [-:.\w]+ (?: \( \S+ \) )? $ }x) {
+ ($manpage, $section) = ($_, '');
+ $manpage =~ s/^([^\(]+)\(/'\f(IS' . $1 . '\f(IE\|('/e;
+ } elsif (m%/%) {
+ ($manpage, $section) = split (/\s*\/\s*/, $_, 2);
+ if ($manpage =~ /^[-:.\w]+(?:\(\S+\))?$/) {
+ $manpage =~ s/^([^\(]+)\(/'\f(IS' . $1 . '\f(IE\|'/e;
+ }
+ $section =~ s/^\"\s*//;
+ $section =~ s/\s*\"$//;
+ }
+ if ($manpage && $manpage !~ /\\f\(IS/) {
+ $manpage = "the $manpage manpage";
+ }
+
+ # Now build the actual output text.
+ my $text = '';
+ if (!length ($section) && !length ($manpage)) {
+ carp "Invalid link $_";
+ } elsif (!length ($section)) {
+ $text = $manpage;
+ } elsif ($section =~ /^[:\w]+(?:\(\))?/) {
+ $text .= 'the ' . $section . ' entry';
+ $text .= (length $manpage) ? " in $manpage"
+ : " elsewhere in this document";
+ } else {
+ $text .= 'the section on "' . $section . '"';
+ $text .= " in $manpage" if length $manpage;
+ }
+ $text;
+}
+
+
+############################################################################
+# Escaping and fontification
+############################################################################
+
+# At this point, we'll have embedded font codes of the form \f(<font>[SE]
+# where <font> is one of B, I, or F. Turn those into the right font start
+# or end codes. B<someI<thing> else> should map to \fBsome\f(BIthing\fB
+# else\fR. The old pod2man didn't get this right; the second \fB was \fR,
+# so nested sequences didn't work right. We take care of this by using
+# variables as a combined pointer to our current font sequence, and set each
+# to the number of current nestings of start tags for that font. Use them
+# as a vector to look up what font sequence to use.
+sub mapfonts {
+ my $self = shift;
+ local $_ = shift;
+
+ my ($fixed, $bold, $italic) = (0, 0, 0);
+ my %magic = (F => \$fixed, B => \$bold, I => \$italic);
+ s { \\f\((.)(.) } {
+ ${ $magic{$1} } += ($2 eq 'S') ? 1 : -1;
+ $$self{FONTS}{($fixed && 1) . ($bold && 1) . ($italic && 1)};
+ }gxe;
+ $_;
+}
+
+
+############################################################################
+# *roff-specific parsing
+############################################################################
+
+# Called instead of parse_text, calls parse_text with the right flags.
+sub parse {
+ my $self = shift;
+ $self->parse_text ({ -expand_seq => 'sequence',
+ -expand_ptree => 'collapse' }, @_);
+}
+
+# Takes a parse tree and a flag saying whether or not to treat it as literal
+# text (not call guesswork on it), and returns the concatenation of all of
+# the text strings in that parse tree. If the literal flag isn't true,
+# guesswork() will be called on all plain scalars in the parse tree.
+# Assumes that everything in the parse tree is either a scalar or a
+# reference to a scalar.
+sub collapse {
+ my ($self, $ptree, $literal) = @_;
+ if ($literal) {
+ return join ('', map {
+ if (ref $_) {
+ $$_;
+ } else {
+ s/\\/\\e/g;
+ $_;
+ }
+ } $ptree->children);
+ } else {
+ return join ('', map {
+ ref ($_) ? $$_ : $self->guesswork ($_)
+ } $ptree->children);
+ }
+}
+
+# Takes a text block to perform guesswork on; this is guaranteed not to
+# contain any interior sequences. Returns the text block with remapping
+# done.
+sub guesswork {
+ my $self = shift;
+ local $_ = shift;
+
+ # rofficate backslashes.
+ s/\\/\\e/g;
+
+ # Ensure double underbars have a tiny space between them.
+ s/__/_\\|_/g;
+
+ # Make all caps a little smaller. Be careful here, since we don't want
+ # to make @ARGV into small caps, nor do we want to fix the MIME in
+ # MIME-Version, since it looks weird with the full-height V.
+ s{
+ ( ^ | [\s\(\"\'\`\[\{<>] )
+ ( [A-Z] [A-Z] [/A-Z+:\d_\$&-]* )
+ (?: (?= [\s>\}\]\)\'\".?!,;:] | -- ) | $ )
+ } { $1 . '\s-1' . $2 . '\s0' . $3 }egx;
+
+ # Turn PI into a pretty pi.
+ s{ (?: \\s-1 | \b ) PI (?: \\s0 | \b ) } {\\*\(PI}gx;
+
+ # Italize functions in the form func().
+ s{
+ \b
+ (
+ [:\w]+ (?:\\s-1)? \(\)
+ )
+ } { '\f(IS' . $1 . '\f(IE' }egx;
+
+ # func(n) is a reference to a manual page. Make it \fIfunc\fR\|(n).
+ s{
+ \b
+ (\w[-:.\w]+ (?:\\s-1)?)
+ (
+ \( [^\)] \)
+ )
+ } { '\f(IS' . $1 . '\f(IE\|' . $2 }egx;
+
+ # Convert simple Perl variable references to a fixed-width font.
+ s{
+ ( \s+ )
+ ( [\$\@%] [\w:]+ )
+ (?! \( )
+ } { $1 . '\f(FS' . $2 . '\f(FE'}egx;
+
+ # Translate -- into a real em dash if it's used like one and fix up
+ # dashes, but keep hyphens hyphens.
+ s{ (\G|^|.) (-+) (\b|.) } {
+ my ($pre, $dash, $post) = ($1, $2, $3);
+ if (length ($dash) == 1) {
+ ($pre =~ /[a-zA-Z]/) ? "$pre-$post" : "$pre\\-$post";
+ } elsif (length ($dash) == 2
+ && ((!$pre && !$post)
+ || ($pre =~ /\w/ && !$post)
+ || ($pre eq ' ' && $post eq ' ')
+ || ($pre eq '=' && $post ne '=')
+ || ($pre ne '=' && $post eq '='))) {
+ "$pre\\*(--$post";
+ } else {
+ $pre . ('\-' x length $dash) . $post;
+ }
+ }egxs;
+
+ # Fix up double quotes.
+ s{ \" ([^\"]+) \" } { '\*(L"' . $1 . '\*(R"' }egx;
+
+ # Make C++ into \*(C+, which is a squinched version.
+ s{ \b C\+\+ } {\\*\(C+}gx;
+
+ # All done.
+ $_;
+}
+
+
+############################################################################
+# Output formatting
+############################################################################
+
+# Make vertical whitespace.
+sub makespace {
+ my $self = shift;
+ $self->output ($$self{INDENT} > 0 ? ".Sp\n" : ".PP\n");
+}
+
+# Output any pending index entries, and optionally an index entry given as
+# an argument. Support multiple index entries in X<> separated by slashes,
+# and strip special escapes from index entries.
+sub outindex {
+ my ($self, $section, $index) = @_;
+ my @entries = map { split m%\s*/\s*% } @{ $$self{INDEX} };
+ return unless ($section || @entries);
+ $$self{INDEX} = [];
+ my $output;
+ if (@entries) {
+ my $output = '.IX Xref "'
+ . join (' ', map { s/\"/\"\"/; $_ } @entries)
+ . '"' . "\n";
+ }
+ if ($section) {
+ $index =~ s/\"/\"\"/;
+ $index =~ s/\\-/-/g;
+ $index =~ s/\\(?:s-?\d|.\(..|.)//g;
+ $output .= ".IX $section " . '"' . $index . '"' . "\n";
+ }
+ $self->output ($output);
+}
+
+# Output text to the output device.
+sub output { print { $_[0]->output_handle } $_[1] }
+
+__END__
+
+.\" These are some extra bits of roff that I don't want to lose track of
+.\" but that have been removed from the preamble to make it a bit shorter
+.\" since they're not currently being used. They're accents and special
+.\" characters we don't currently have escapes for.
+.if n \{\
+. ds ? ?
+. ds ! !
+. ds q
+.\}
+.if t \{\
+. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
+. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
+. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
+.\}
+.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
+.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
+.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
+.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
+.ds oe o\h'-(\w'o'u*4/10)'e
+.ds Oe O\h'-(\w'O'u*4/10)'E
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds v \h'-1'\o'\(aa\(ga'
+. ds _ \h'-1'^
+. ds . \h'-1'.
+. ds 3 3
+. ds oe oe
+. ds Oe OE
+.\}
+
+############################################################################
+# Documentation
+############################################################################
+
+=head1 NAME
+
+Pod::Man - Convert POD data to formatted *roff input
+
+=head1 SYNOPSIS
+
+ use Pod::Man;
+ my $parser = Pod::Man->new (release => $VERSION, section => 8);
+
+ # Read POD from STDIN and write to STDOUT.
+ $parser->parse_from_filehandle;
+
+ # Read POD from file.pod and write to file.1.
+ $parser->parse_from_file ('file.pod', 'file.1');
+
+=head1 DESCRIPTION
+
+Pod::Man is a module to convert documentation in the POD format (the
+preferred language for documenting Perl) into *roff input using the man
+macro set. The resulting *roff code is suitable for display on a terminal
+using nroff(1), normally via man(1), or printing using troff(1). It is
+conventionally invoked using the driver script B<pod2roff>, but it can also
+be used directly.
+
+As a derived class from Pod::Parser, Pod::Man supports the same methods and
+interfaces. See L<Pod::Parser> for all the details; briefly, one creates a
+new parser with C<Pod::Man-E<gt>new()> and then calls either
+parse_from_filehandle() or parse_from_file().
+
+new() can take options, in the form of key/value pairs that control the
+behavior of the parser. See below for details.
+
+If no options are given, Pod::Man uses the name of the input file with any
+trailing C<.pod>, C<.pm>, or C<.pl> stripped as the man page title, to
+section 1 unless the file ended in C<.pm> in which case it defaults to
+section 3, to a centered title of "User Contributed Perl Documentation", to
+a centered footer of the Perl version it is run with, and to a left-hand
+footer of the modification date of its input (or the current date if given
+STDIN for input).
+
+Pod::Man assumes that your *roff formatters have a fixed-width font named
+CW. If yours is called something else (like CR), use the C<fixed> option to
+specify it. This generally only matters for troff output for printing.
+Similarly, you can set the fonts used for bold, italic, and bold italic
+fixed-width output.
+
+Besides the obvious pod conversions, Pod::Man also takes care of formatting
+func(), func(n), and simple variable references like $foo or @bar so you
+don't have to use code escapes for them; complex expressions like
+C<$fred{'stuff'}> will still need to be escaped, though. It also translates
+dashes that aren't used as hyphens into en dashes, makes long dashes--like
+this--into proper em dashes, fixes "paired quotes," makes C++ and PI look
+right, puts a little space between double underbars, makes ALLCAPS a teeny
+bit smaller in troff(1), and escapes stuff that *roff treats as special so
+that you don't have to.
+
+The recognized options to new() are as follows. All options take a single
+argument.
+
+=over 4
+
+=item center
+
+Sets the centered page header to use instead of "User Contributed Perl
+Documentation".
+
+=item date
+
+Sets the left-hand footer. By default, the modification date of the input
+file will be used, or the current date if stat() can't find that file (the
+case if the input is from STDIN), and the date will be formatted as
+YYYY-MM-DD.
+
+=item fixed
+
+The fixed-width font to use for vertabim text and code. Defaults to CW.
+Some systems may want CR instead. Only matters for troff(1) output.
+
+=item fixedbold
+
+Bold version of the fixed-width font. Defaults to CB. Only matters for
+troff(1) output.
+
+=item fixeditalic
+
+Italic version of the fixed-width font (actually, something of a misnomer,
+since most fixed-width fonts only have an oblique version, not an italic
+version). Defaults to CI. Only matters for troff(1) output.
+
+=item fixedbolditalic
+
+Bold italic (probably actually oblique) version of the fixed-width font.
+Pod::Man doesn't assume you have this, and defaults to CB. Some systems
+(such as Solaris) have this font available as CX. Only matters for troff(1)
+output.
+
+=item release
+
+Set the centered footer. By default, this is the version of Perl you run
+Pod::Man under. Note that some system an macro sets assume that the
+centered footer will be a modification date and will prepend something like
+"Last modified: "; if this is the case, you may want to set C<release> to
+the last modified date and C<date> to the version number.
+
+=item section
+
+Set the section for the C<.TH> macro. The standard section numbering
+convention is to use 1 for user commands, 2 for system calls, 3 for
+functions, 4 for devices, 5 for file formats, 6 for games, 7 for
+miscellaneous information, and 8 for administrator commands. There is a lot
+of variation here, however; some systems (like Solaris) use 4 for file
+formats, 5 for miscellaneous information, and 7 for devices. Still others
+use 1m instead of 8, or some mix of both. About the only section numbers
+that are reliably consistent are 1, 2, and 3.
+
+By default, section 1 will be used unless the file ends in .pm in which case
+section 3 will be selected.
+
+=back
+
+The standard Pod::Parser method parse_from_filehandle() takes up to two
+arguments, the first being the file handle to read POD from and the second
+being the file handle to write the formatted output to. The first defaults
+to STDIN if not given, and the second defaults to STDOUT. The method
+parse_from_file() is almost identical, except that its two arguments are the
+input and output disk files instead. See L<Pod::Parser> for the specific
+details.
+
+=head1 DIAGNOSTICS
+
+=over 4
+
+=item roff font should be 1 or 2 chars, not `%s'
+
+(F) You specified a *roff font (using C<fixed>, C<fixedbold>, etc.) that
+wasn't either one or two characters. Pod::Man doesn't support *roff fonts
+longer than two characters, although some *roff extensions do (the canonical
+versions of nroff(1) and troff(1) don't either).
+
+=item Invalid link %s
+
+(W) The POD source contained a C<LE<lt>E<gt>> sequence that Pod::Man was
+unable to parse. You should never see this error message; it probably
+indicates a bug in Pod::Man.
+
+=item Unknown escape EE<lt>%sE<gt>
+
+(W) The POD source contained an C<EE<lt>E<gt>> escape that Pod::Man didn't
+know about. C<EE<lt>%sE<gt>> was printed verbatim in the output.
+
+=item Unknown sequence %s
+
+(W) The POD source contained a non-standard interior sequence (something of
+the form C<XE<lt>E<gt>>) that Pod::Man didn't know about. It was ignored.
+
+=item Unmatched =back
+
+(W) Pod::Man encountered a C<=back> command that didn't correspond to an
+C<=over> command.
+
+=back
+
+=head1 BUGS
+
+The lint-like features and strict POD format checking done by B<pod2man> are
+not yet implemented and should be, along with the corresponding C<lax>
+option.
+
+The NAME section should be recognized specially and index entries emitted
+for everything in that section. This would have to be deferred until the
+next section, since extraneous things in NAME tends to confuse various man
+page processors.
+
+The handling of hyphens, en dashes, and em dashes is somewhat fragile, and
+one may get the wrong one under some circumstances. This should only matter
+for troff(1) output.
+
+When and whether to use small caps is somewhat tricky, and Pod::Man doesn't
+necessarily get it right.
+
+Pod::Man doesn't handle font names longer than two characters. Neither do
+most troff(1) implementations, but GNU troff does as an extension. It would
+be nice to support as an option for those who want to use it.
+
+The preamble added to each output file is rather verbose, and most of it is
+only necessary in the presence of EE<lt>E<gt> escapes for non-ASCII
+characters. It would ideally be nice if all of those definitions were only
+output if needed, perhaps on the fly as the characters are used.
+
+Some of the automagic applied to file names assumes Unix directory
+separators.
+
+Pod::Man is excessively slow.
+
+=head1 NOTES
+
+The intention is for this module and its driver script to eventually replace
+B<pod2man> in Perl core.
+
+=head1 SEE ALSO
+
+L<Pod::Parser|Pod::Parser>, perlpod(1), pod2roff(1), nroff(1), troff(1),
+man(1), man(7)
+
+Ossanna, Joseph F., and Brian W. Kernighan. "Troff User's Manual,"
+Computing Science Technical Report No. 54, AT&T Bell Laboratories. This is
+the best documentation of standard nroff(1) and troff(1). At the time of
+this writing, it's available at http://www.cs.bell-labs.com/cm/cs/cstr.html.
+
+The man page documenting the man macro set may be man(5) instead of man(7)
+on your system. Also, please see pod2roff(1) for extensive documentation on
+writing manual pages if you've not done it before and aren't familiar with
+the conventions.
+
+=head1 AUTHOR
+
+Russ Allbery E<lt>rra@stanford.eduE<gt>, based I<very> heavily on the
+original B<pod2man> by Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>.
+
+=cut
diff --git a/lib/Pod/Parser.pm b/lib/Pod/Parser.pm
index cb1e3a61c1..c96f86b298 100644
--- a/lib/Pod/Parser.pm
+++ b/lib/Pod/Parser.pm
@@ -1,10 +1,7 @@
#############################################################################
# Pod/Parser.pm -- package which defines a base class for parsing POD docs.
#
-# Based on Tom Christiansen's Pod::Text module
-# (with extensive modifications).
-#
-# Copyright (C) 1996-1999 Tom Christiansen. All rights reserved.
+# Copyright (C) 1996-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
@@ -13,7 +10,7 @@
package Pod::Parser;
use vars qw($VERSION);
-$VERSION = 1.081; ## Current version of this package
+$VERSION = 1.085; ## Current version of this package
require 5.004; ## requires this Perl version or later
#############################################################################
@@ -145,6 +142,50 @@ For the most part, the B<Pod::Parser> base class should be able to
do most of the input parsing for you and leave you free to worry about
how to intepret the commands and translate the result.
+Note that all we have described here in this quick overview overview is
+the simplest most striaghtforward use of B<Pod::Parser> to do stream-based
+parsing. It is also possible to use the B<Pod::Parser::parse_text> function
+to do more sophisticated tree-based parsing. See L<"TREE-BASED PARSING">.
+
+=head1 PARSING OPTIONS
+
+A I<parse-option> is simply a named option of B<Pod::Parser> with a
+value that corresponds to a certain specified behavior. These various
+behaviors of B<Pod::Parser> may be enabled/disabled by setting or
+or unsetting one or more I<parse-options> using the B<parseopts()> method.
+The set of currently accepted parse-options is as follows:
+
+=over 3
+
+=item B<-want_nonPODs> (default: unset)
+
+Normally (by default) B<Pod::Parser> will only provide access to
+the POD sections of the input. Input paragraphs that are not part
+of the POD-format documentation are not made available to the caller
+(not even using B<preprocess_paragraph()>). Setting this option to a
+non-empty, non-zero value will allow B<preprocess_paragraph()> to see
+non-POD sectioins of the input as well as POD sections. The B<cutting()>
+method can be used to determine if the corresponding paragraph is a POD
+paragraph, or some other input paragraph.
+
+=item B<-process_cut_cmd> (default: unset)
+
+Normally (by default) B<Pod::Parser> handles the C<=cut> POD directive
+by itself and does not pass it on to the caller for processing. Setting
+this option to non-empty, non-zero value will cause B<Pod::Parser> to
+pass the C<=cut> directive to the caller just like any other POD command
+(and hence it may be processed by the B<command()> method).
+
+B<Pod::Parser> will still interpret the C<=cut> directive to mean that
+"cutting mode" has been (re)entered, but the caller will get a chance
+to capture the actual C<=cut> paragraph itself for whatever purpose
+it desires.
+
+=back
+
+Please see L<"parseopts()"> for a complete description of the interface
+for the setting and unsetting of parse-options.
+
=cut
#############################################################################
@@ -159,7 +200,7 @@ use Exporter;
@ISA = qw(Exporter);
## These "variables" are used as local "glob aliases" for performance
-use vars qw(%myData @input_stack);
+use vars qw(%myData %myOpts @input_stack);
#############################################################################
@@ -574,8 +615,9 @@ sub preprocess_paragraph {
=head1 METHODS FOR PARSING AND PROCESSING
B<Pod::Parser> provides several methods to process input text. These
-methods typically won't need to be overridden, but subclasses may want
-to invoke them to exploit their functionality.
+methods typically won't need to be overridden (and in some cases they
+can't be overridden), but subclasses may want to invoke them to exploit
+their functionality.
=cut
@@ -629,6 +671,31 @@ is a reference to the interior-sequence object.
[I<NOTE>: If the B<interior_sequence()> method is specified, then it is
invoked according to the interface specified in L<"interior_sequence()">].
+=item B<-expand_text> =E<gt> I<code-ref>|I<method-name>
+
+Normally, the parse-tree returned by B<parse_text()> will contain a
+text-string for each contiguous sequence of characters outside of an
+interior-sequence. Specifying B<-expand_text> tells B<parse_text()> to
+"preprocess" every such text-string it sees by invoking the referenced
+function (or named method of the parser object) and using the return value
+as the preprocessed (or "expanded") result. [Note that if the result is
+an interior-sequence, then it will I<not> be expanded as specified by the
+B<-expand_seq> option; Any such recursive expansion needs to be handled by
+the specified callback routine.]
+
+If a subroutine reference was given, it is invoked as:
+
+ &$code_ref( $parser, $text, $ptree_node )
+
+and if a method-name was given, it is invoked as:
+
+ $parser->method_name( $text, $ptree_node )
+
+where C<$parser> is a reference to the parser object, C<$text> is the
+text-string encountered, and C<$ptree_node> is a reference to the current
+node in the parse-tree (usually an interior-sequence object or else the
+top-level node of the parse-tree).
+
=item B<-expand_ptree> =E<gt> I<code-ref>|I<method-name>
Rather than returning a C<Pod::ParseTree>, pass the parse-tree as an
@@ -652,10 +719,10 @@ is a reference to the parse-tree object.
## This global regex is used to see if the text before a '>' inside
## an interior sequence looks like '-' or '=', but not '--', '==',
-## '$-', or '$='
+## '!=', '$-', '$=' or <<op>>=
use vars qw( $ARROW_RE );
-$ARROW_RE = join('', qw{ (?: [^-+*/=!&|%^x.<>$]= | [^$-]- )$ });
-#$ARROW_RE = qr/(?:[^=]+=|[^-]+-)$/; ## 5.005+ only!
+$ARROW_RE = join('', qw{ (?: [^-+*/=!&|%^x.<>$]= | [^-$]- )$ });
+#$ARROW_RE = qr/(?:[^-+*/=!&|%^x.<>$]+=|[^-$]+-)$/; ## 5.005+ only!
sub parse_text {
my $self = shift;
@@ -664,6 +731,7 @@ sub parse_text {
## Get options and set any defaults
my %opts = (ref $_[0]) ? %{ shift() } : ();
my $expand_seq = $opts{'-expand_seq'} || undef;
+ my $expand_text = $opts{'-expand_text'} || undef;
my $expand_ptree = $opts{'-expand_ptree'} || undef;
my $text = shift;
@@ -673,6 +741,7 @@ sub parse_text {
## Convert method calls into closures, for our convenience
my $xseq_sub = $expand_seq;
+ my $xtext_sub = $expand_text;
my $xptree_sub = $expand_ptree;
if (defined $expand_seq and $expand_seq eq 'interior_sequence') {
## If 'interior_sequence' is the method to use, we have to pass
@@ -685,6 +754,7 @@ sub parse_text {
};
}
ref $xseq_sub or $xseq_sub = sub { shift()->$expand_seq(@_) };
+ ref $xtext_sub or $xtext_sub = sub { shift()->$expand_text(@_) };
ref $xptree_sub or $xptree_sub = sub { shift()->$expand_ptree(@_) };
## Keep track of the "current" interior sequence, and maintain a stack
@@ -729,19 +799,24 @@ sub parse_text {
## Remember the current cmd-name
$cmd = (@seq_stack > 1) ? $seq_stack[-1]->name : '';
}
- else {
- ## In the middle of a sequence, append this text to it
- $seq->append($_) if length;
+ elsif (length) {
+ ## In the middle of a sequence, append this text to it, and
+ ## dont forget to "expand" it if that's what the caller wanted
+ $seq->append($expand_text ? &$xtext_sub($self,$_,$seq) : $_);
}
## Remember the "current" sequence and the previously seen token
($seq, $prev) = ( $seq_stack[-1], $_ );
}
## Handle unterminated sequences
+ my $errorsub = (@seq_stack > 1) ? $self->errorsub() : undef;
while (@seq_stack > 1) {
($cmd, $file, $line) = ($seq->name, $seq->file_line);
pop @seq_stack;
- warn "** Unterminated $cmd<...> at $file line $line\n";
+ my $errmsg = "** Unterminated $cmd<...> at $file line $line\n";
+ (ref $errorsub) and &{$errorsub}($errmsg)
+ or (defined $errmsg) and $self->$errorsub($errmsg)
+ or warn($errmsg);
$seq_stack[-1]->append($expand_seq ? &$xseq_sub($self,$seq) : $seq);
$seq = $seq_stack[-1];
}
@@ -788,7 +863,8 @@ This method takes the text of a POD paragraph to be processed, along
with its corresponding line number, and invokes the appropriate method
(one of B<command()>, B<verbatim()>, or B<textblock()>).
-This method does I<not> usually need to be overridden by subclasses.
+For performance reasons, this method is invoked directly without any
+dynamic lookup; Hence subclasses may I<not> override it!
=end __PRIVATE__
@@ -796,9 +872,16 @@ This method does I<not> usually need to be overridden by subclasses.
sub parse_paragraph {
my ($self, $text, $line_num) = @_;
- local *myData = $self; ## an alias to avoid deref-ing overhead
+ local *myData = $self; ## alias to avoid deref-ing overhead
+ local *myOpts = ($myData{_PARSEOPTS} ||= {}); ## get parse-options
local $_;
+ ## See if we want to preprocess nonPOD paragraphs as well as POD ones.
+ my $wantNonPods = $myOpts{'-want_nonPODs'} || 0;
+
+ ## Perform any desired preprocessing if we wanted it this early
+ $wantNonPods and $text = $self->preprocess_paragraph($text, $line_num);
+
## This is the end of a non-empty paragraph
## Ignore up until next POD directive if we are cutting
if ($myData{_CUTTING}) {
@@ -822,10 +905,13 @@ sub parse_paragraph {
$self->is_selected($text) or return ($myData{_CUTTING} = 1);
}
- ## Perform any desired preprocessing and re-check the "cutting" state
- $text = $self->preprocess_paragraph($text, $line_num);
- return 1 unless ((defined $text) and (length $text));
- return 1 if ($myData{_CUTTING});
+ ## If we havent already, perform any desired preprocessing and
+ ## then re-check the "cutting" state
+ unless ($wantNonPods) {
+ $text = $self->preprocess_paragraph($text, $line_num);
+ return 1 unless ((defined $text) and (length $text));
+ return 1 if ($myData{_CUTTING});
+ }
## Look for one of the three types of paragraphs
my ($pfx, $cmd, $arg, $sep) = ('', '', '', '');
@@ -842,7 +928,7 @@ sub parse_paragraph {
## except return to "cutting" mode.
if ($cmd eq 'cut') {
$myData{_CUTTING} = 1;
- return;
+ return unless $myOpts{'-process_cut_cmd'};
}
}
## Save the attributes indicating how the command was specified.
@@ -1097,6 +1183,35 @@ instance data fields:
##---------------------------------------------------------------------------
+=head1 B<errorsub()>
+
+ $parser->errorsub("method_name");
+ $parser->errorsub(\&warn_user);
+ $parser->errorsub(sub { print STDERR, @_ });
+
+Specifies the method or subroutine to use when printing error messages
+about POD syntax. The supplied method/subroutine I<must> return TRUE upon
+successful printing of the message. If C<undef> is given, then the B<warn>
+builtin is used to issue error messages (this is the default behavior).
+
+ my $errorsub = $parser->errorsub()
+ my $errmsg = "This is an error message!\n"
+ (ref $errorsub) and &{$errorsub}($errmsg)
+ or (defined $errmsg) and $parser->$errorsub($errmsg)
+ or warn($errmsg);
+
+Returns a method name, or else a reference to the user-supplied subroutine
+used to print error messages. Returns C<undef> if the B<warn> builtin
+is used to issue error messages (this is the default behavior).
+
+=cut
+
+sub errorsub {
+ return (@_ > 1) ? ($_[0]->{_ERRORSUB} = $_[1]) : $_[0]->{_ERRORSUB};
+}
+
+##---------------------------------------------------------------------------
+
=head1 B<cutting()>
$boolean = $parser->cutting();
@@ -1118,6 +1233,58 @@ sub cutting {
##---------------------------------------------------------------------------
+##---------------------------------------------------------------------------
+
+=head1 B<parseopts()>
+
+When invoked with no additional arguments, B<parseopts> returns a hashtable
+of all the current parsing options.
+
+ ## See if we are parsing non-POD sections as well as POD ones
+ my %opts = $parser->parseopts();
+ $opts{'-want_nonPODs}' and print "-want_nonPODs\n";
+
+When invoked using a single string, B<parseopts> treats the string as the
+name of a parse-option and returns its corresponding value if it exists
+(returns C<undef> if it doesn't).
+
+ ## Did we ask to see '=cut' paragraphs?
+ my $want_cut = $parser->parseopts('-process_cut_cmd');
+ $want_cut and print "-process_cut_cmd\n";
+
+When invoked with multiple arguments, B<parseopts> treats them as
+key/value pairs and the specified parse-option names are set to the
+given values. Any unspecified parse-options are unaffected.
+
+ ## Set them back to the default
+ $parser->parseopts(-process_cut_cmd => 0);
+
+When passed a single hash-ref, B<parseopts> uses that hash to completely
+reset the existing parse-options, all previous parse-option values
+are lost.
+
+ ## Reset all options to default
+ $parser->parseopts( { } );
+
+See L<"PARSING OPTIONS"> for more for the name and meaning of each
+parse-option currently recognized.
+
+=cut
+
+sub parseopts {
+ local *myData = shift;
+ local *myOpts = ($myData{_PARSEOPTS} ||= {});
+ return %myOpts if (@_ == 0);
+ if (@_ == 1) {
+ local $_ = shift;
+ return ref($_) ? $myData{_PARSEOPTS} = $_ : $myOpts{$_};
+ }
+ my @newOpts = (%myOpts, @_);
+ $myData{_PARSEOPTS} = { @newOpts };
+}
+
+##---------------------------------------------------------------------------
+
=head1 B<output_file()>
$fname = $parser->output_file();
@@ -1361,6 +1528,159 @@ sub _pop_input_stream {
#############################################################################
+=head1 TREE-BASED PARSING
+
+If straightforward stream-based parsing wont meet your needs (as is
+likely the case for tasks such as translating PODs into structured
+markup languages like HTML and XML) then you may need to take the
+tree-based approach. Rather than doing everything in one pass and
+calling the B<interpolate()> method to expand sequences into text, it
+may be desirable to instead create a parse-tree using the B<parse_text()>
+method to return a tree-like structure which may contain an ordered list
+list of children (each of which may be a text-string, or a similar
+tree-like structure).
+
+Pay special attention to L<"METHODS FOR PARSING AND PROCESSING"> and
+to the objects described in L<Pod::InputObjects>. The former describes
+the gory details and parameters for how to customize and extend the
+parsing behavior of B<Pod::Parser>. B<Pod::InputObjects> provides
+several objects that may all be used interchangeably as parse-trees. The
+most obvious one is the B<Pod::ParseTree> object. It defines the basic
+interface and functionality that all things trying to be a POD parse-tree
+should do. A B<Pod::ParseTree> is defined such that each "node" may be a
+text-string, or a reference to another parse-tree. Each B<Pod::Paragraph>
+object and each B<Pod::InteriorSequence> object also supports the basic
+parse-tree interface.
+
+The B<parse_text()> method takes a given paragraph of text, and
+returns a parse-tree that contains one or more children, each of which
+may be a text-string, or an InteriorSequence object. There are also
+callback-options that may be passed to B<parse_text()> to customize
+the way it expands or transforms interior-sequences, as well as the
+returned result. These callbacks can be used to create a parse-tree
+with custom-made objects (which may or may not support the parse-tree
+interface, depending on how you choose to do it).
+
+If you wish to turn an entire POD document into a parse-tree, that process
+is fairly straightforward. The B<parse_text()> method is the key to doing
+this successfully. Every paragraph-callback (i.e. the polymorphic methods
+for B<command()>, B<verbatim()>, and B<textblock()> paragraphs) takes
+a B<Pod::Paragraph> object as an argument. Each paragraph object has a
+B<parse_tree()> method that can be used to get or set a corresponding
+parse-tree. So for each of those paragraph-callback methods, simply call
+B<parse_text()> with the options you desire, and then use the returned
+parse-tree to assign to the given paragraph object.
+
+That gives you a parse-tree for each paragraph - so now all you need is
+an ordered list of paragraphs. You can maintain that yourself as a data
+element in the object/hash. The most straightforward way would be simply
+to use an array-ref, with the desired set of custom "options" for each
+invocation of B<parse_text>. Let's assume the desired option-set is
+given by the hash C<%options>. Then we might do something like the
+following:
+
+ package MyPodParserTree;
+
+ @ISA = qw( Pod::Parser );
+
+ ...
+
+ sub begin_pod {
+ my $self = shift;
+ $self->{'-paragraphs'} = []; ## initialize paragraph list
+ }
+
+ sub command {
+ my ($parser, $command, $paragraph, $line_num, $pod_para) = @_;
+ my $ptree = $parser->parse_text({%options}, $paragraph, ...);
+ $pod_para->parse_tree( $ptree );
+ push @{ $self->{'-paragraphs'} }, $pod_para;
+ }
+
+ sub verbatim {
+ my ($parser, $paragraph, $line_num, $pod_para) = @_;
+ push @{ $self->{'-paragraphs'} }, $pod_para;
+ }
+
+ sub textblock {
+ my ($parser, $paragraph, $line_num, $pod_para) = @_;
+ my $ptree = $parser->parse_text({%options}, $paragraph, ...);
+ $pod_para->parse_tree( $ptree );
+ push @{ $self->{'-paragraphs'} }, $pod_para;
+ }
+
+ ...
+
+ package main;
+ ...
+ my $parser = new MyPodParserTree(...);
+ $parser->parse_from_file(...);
+ my $paragraphs_ref = $parser->{'-paragraphs'};
+
+Of course, in this module-author's humble opinion, I'd be more inclined to
+use the existing B<Pod::ParseTree> object than a simple array. That way
+everything in it, paragraphs and sequences, all respond to the same core
+interface for all parse-tree nodes. The result would look something like:
+
+ package MyPodParserTree2;
+
+ ...
+
+ sub begin_pod {
+ my $self = shift;
+ $self->{'-ptree'} = new Pod::ParseTree; ## initialize parse-tree
+ }
+
+ sub parse_tree {
+ ## convenience method to get/set the parse-tree for the entire POD
+ (@_ > 1) and $_[0]->{'-ptree'} = $_[1];
+ return $_[0]->{'-ptree'};
+ }
+
+ sub command {
+ my ($parser, $command, $paragraph, $line_num, $pod_para) = @_;
+ my $ptree = $parser->parse_text({<<options>>}, $paragraph, ...);
+ $pod_para->parse_tree( $ptree );
+ $parser->parse_tree()->append( $pod_para );
+ }
+
+ sub verbatim {
+ my ($parser, $paragraph, $line_num, $pod_para) = @_;
+ $parser->parse_tree()->append( $pod_para );
+ }
+
+ sub textblock {
+ my ($parser, $paragraph, $line_num, $pod_para) = @_;
+ my $ptree = $parser->parse_text({<<options>>}, $paragraph, ...);
+ $pod_para->parse_tree( $ptree );
+ $parser->parse_tree()->append( $pod_para );
+ }
+
+ ...
+
+ package main;
+ ...
+ my $parser = new MyPodParserTree2(...);
+ $parser->parse_from_file(...);
+ my $ptree = $parser->parse_tree;
+ ...
+
+Now you have the entire POD document as one great big parse-tree. You
+can even use the B<-expand_seq> option to B<parse_text> to insert
+whole different kinds of objects. Just don't expect B<Pod::Parser>
+to know what to do with them after that. That will need to be in your
+code. Or, alternatively, you can insert any object you like so long as
+it conforms to the B<Pod::ParseTree> interface.
+
+One could use this to create subclasses of B<Pod::Paragraphs> and
+B<Pod::InteriorSequences> for specific commands (or to create your own
+custom node-types in the parse-tree) and add some kind of B<emit()>
+method to each custom node/subclass object in the tree. Then all you'd
+need to do is recursively walk the tree in the desired order, processing
+the children (most likely from left to right) by formatting them if
+they are text-strings, or by calling their B<emit()> method if they
+are objects/references.
+
=head1 SEE ALSO
L<Pod::InputObjects>, L<Pod::Select>
diff --git a/lib/Pod/PlainText.pm b/lib/Pod/PlainText.pm
deleted file mode 100644
index 3816badb7f..0000000000
--- a/lib/Pod/PlainText.pm
+++ /dev/null
@@ -1,650 +0,0 @@
-#############################################################################
-# Pod/PlainText.pm -- convert POD data to formatted ASCII text
-#
-# Derived from Tom Christiansen's Pod::PlainText module
-# (with extensive modifications).
-#
-# Copyright (C) 1994-1999 Tom Christiansen. All rights reserved.
-# This file is part of "PodParser". PodParser is free software;
-# you can redistribute it and/or modify it under the same terms
-# as Perl itself.
-#############################################################################
-
-package Pod::PlainText;
-
-use vars qw($VERSION);
-$VERSION = 1.081; ## Current version of this package
-require 5.004; ## requires this Perl version or later
-
-=head1 NAME
-
-pod2plaintext - function to convert POD data to formatted ASCII text
-
-Pod::PlainText - a class for converting POD data to formatted ASCII text
-
-=head1 SYNOPSIS
-
- use Pod::PlainText;
- pod2plaintext("perlfunc.pod");
-
-or
-
- use Pod::PlainText;
- package MyParser;
- @ISA = qw(Pod::PlainText);
-
- sub new {
- ## constructor code ...
- }
-
- ## implementation of appropriate subclass methods ...
-
- package main;
- $parser = new MyParser;
- @ARGV = ('-') unless (@ARGV > 0);
- for (@ARGV) {
- $parser->parse_from_file($_);
- }
-
-=head1 REQUIRES
-
-perl5.004, Pod::Select, Term::Cap, Exporter, Carp
-
-=head1 EXPORTS
-
-pod2plaintext()
-
-=head1 DESCRIPTION
-
-Pod::PlainText is a module that can convert documentation in the POD
-format (such as can be found throughout the Perl distribution) into
-formatted ASCII. Termcap is optionally supported for
-boldface/underline, and can be enabled via C<$Pod::PlainText::termcap=1>.
-If termcap has not been enabled, then backspaces will be used to
-simulate bold and underlined text.
-
-A separate F<pod2plaintext> program is included that is primarily a wrapper
-for C<Pod::PlainText::pod2plaintext()>.
-
-The single function C<pod2plaintext()> can take one or two arguments. The first
-should be the name of a file to read the pod from, or "<&STDIN" to read from
-STDIN. A second argument, if provided, should be a filehandle glob where
-output should be sent.
-
-=head1 SEE ALSO
-
-L<Pod::Parser>.
-
-=head1 AUTHOR
-
-Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
-
-Modified to derive from B<Pod::Parser> by
-Brad Appleton E<lt>bradapp@enteract.comE<gt>
-
-=cut
-
-#############################################################################
-
-use strict;
-#use diagnostics;
-use Carp;
-use Exporter;
-use Pod::Select;
-use Term::Cap;
-use vars qw(@ISA @EXPORT %HTML_Escapes);
-
-@ISA = qw(Exporter Pod::Select);
-@EXPORT = qw(&pod2plaintext);
-
-%HTML_Escapes = (
- 'amp' => '&', # ampersand
- 'lt' => '<', # left chevron, less-than
- 'gt' => '>', # right chevron, greater-than
- 'quot' => '"', # double quote
-
- "Aacute" => "\xC1", # capital A, acute accent
- "aacute" => "\xE1", # small a, acute accent
- "Acirc" => "\xC2", # capital A, circumflex accent
- "acirc" => "\xE2", # small a, circumflex accent
- "AElig" => "\xC6", # capital AE diphthong (ligature)
- "aelig" => "\xE6", # small ae diphthong (ligature)
- "Agrave" => "\xC0", # capital A, grave accent
- "agrave" => "\xE0", # small a, grave accent
- "Aring" => "\xC5", # capital A, ring
- "aring" => "\xE5", # small a, ring
- "Atilde" => "\xC3", # capital A, tilde
- "atilde" => "\xE3", # small a, tilde
- "Auml" => "\xC4", # capital A, dieresis or umlaut mark
- "auml" => "\xE4", # small a, dieresis or umlaut mark
- "Ccedil" => "\xC7", # capital C, cedilla
- "ccedil" => "\xE7", # small c, cedilla
- "Eacute" => "\xC9", # capital E, acute accent
- "eacute" => "\xE9", # small e, acute accent
- "Ecirc" => "\xCA", # capital E, circumflex accent
- "ecirc" => "\xEA", # small e, circumflex accent
- "Egrave" => "\xC8", # capital E, grave accent
- "egrave" => "\xE8", # small e, grave accent
- "ETH" => "\xD0", # capital Eth, Icelandic
- "eth" => "\xF0", # small eth, Icelandic
- "Euml" => "\xCB", # capital E, dieresis or umlaut mark
- "euml" => "\xEB", # small e, dieresis or umlaut mark
- "Iacute" => "\xCD", # capital I, acute accent
- "iacute" => "\xED", # small i, acute accent
- "Icirc" => "\xCE", # capital I, circumflex accent
- "icirc" => "\xEE", # small i, circumflex accent
- "Igrave" => "\xCD", # capital I, grave accent
- "igrave" => "\xED", # small i, grave accent
- "Iuml" => "\xCF", # capital I, dieresis or umlaut mark
- "iuml" => "\xEF", # small i, dieresis or umlaut mark
- "Ntilde" => "\xD1", # capital N, tilde
- "ntilde" => "\xF1", # small n, tilde
- "Oacute" => "\xD3", # capital O, acute accent
- "oacute" => "\xF3", # small o, acute accent
- "Ocirc" => "\xD4", # capital O, circumflex accent
- "ocirc" => "\xF4", # small o, circumflex accent
- "Ograve" => "\xD2", # capital O, grave accent
- "ograve" => "\xF2", # small o, grave accent
- "Oslash" => "\xD8", # capital O, slash
- "oslash" => "\xF8", # small o, slash
- "Otilde" => "\xD5", # capital O, tilde
- "otilde" => "\xF5", # small o, tilde
- "Ouml" => "\xD6", # capital O, dieresis or umlaut mark
- "ouml" => "\xF6", # small o, dieresis or umlaut mark
- "szlig" => "\xDF", # small sharp s, German (sz ligature)
- "THORN" => "\xDE", # capital THORN, Icelandic
- "thorn" => "\xFE", # small thorn, Icelandic
- "Uacute" => "\xDA", # capital U, acute accent
- "uacute" => "\xFA", # small u, acute accent
- "Ucirc" => "\xDB", # capital U, circumflex accent
- "ucirc" => "\xFB", # small u, circumflex accent
- "Ugrave" => "\xD9", # capital U, grave accent
- "ugrave" => "\xF9", # small u, grave accent
- "Uuml" => "\xDC", # capital U, dieresis or umlaut mark
- "uuml" => "\xFC", # small u, dieresis or umlaut mark
- "Yacute" => "\xDD", # capital Y, acute accent
- "yacute" => "\xFD", # small y, acute accent
- "yuml" => "\xFF", # small y, dieresis or umlaut mark
-
- "lchevron" => "\xAB", # left chevron (double less than)
- "rchevron" => "\xBB", # right chevron (double greater than)
-);
-
-##---------------------------------
-## Function definitions begin here
-##---------------------------------
-
- ## Try to find #columns for the tty
-my %NotUnix = map {($_ => 1)} qw(MacOS MSWin32 VMS MVS);
-sub get_screen {
- ((defined $ENV{TERMCAP}) && ($ENV{TERMCAP} =~ /co#(\d+)/)[0])
- or ((defined $ENV{COLUMNS}) && $ENV{COLUMNS})
- or (!$NotUnix{$^O} && (`stty -a 2>/dev/null` =~ /(\d+) columns/)[0])
- or 72;
-
-}
-
-sub pod2plaintext {
- my ($infile, $outfile) = @_;
- local $_;
- my $text_parser = new Pod::PlainText;
- $text_parser->parse_from_file($infile, $outfile);
-}
-
-##-------------------------------
-## Method definitions begin here
-##-------------------------------
-
-sub new {
- my $this = shift;
- my $class = ref($this) || $this;
- my %params = @_;
- my $self = {%params};
- bless $self, $class;
- $self->initialize();
- return $self;
-}
-
-sub initialize {
- my $self = shift;
- $self->SUPER::initialize();
- return;
-}
-
-sub makespace {
- my $self = shift;
- my $out_fh = $self->output_handle();
- if ($self->{NEEDSPACE}) {
- print $out_fh "\n";
- $self->{NEEDSPACE} = 0;
- }
-}
-
-sub bold {
- my $self = shift;
- my $line = shift;
- my $map = $self->{FONTMAP};
- return $line if $self->{USE_FORMAT};
- if ($self->{TERMCAP}) {
- $line = "$map->{BOLD}$line$map->{NORM}";
- }
- else {
- $line =~ s/(.)/$1\b$1/g;
- }
-# $line = "$map->{BOLD}$line$map->{NORM}" if $self->{ANSIFY};
- return $line;
-}
-
-sub italic {
- my $self = shift;
- my $line = shift;
- my $map = $self->{FONTMAP};
- return $line if $self->{USE_FORMAT};
- if ($self->{TERMCAP}) {
- $line = "$map->{UNDL}$line$map->{NORM}";
- }
- else {
- $line =~ s/(.)/$1\b_/g;
- }
-# $line = "$map->{UNDL}$line$map->{NORM}" if $self->{ANSIFY};
- return $line;
-}
-
-# Fill a paragraph including underlined and overstricken chars.
-# It's not perfect for words longer than the margin, and it's probably
-# slow, but it works.
-sub fill {
- my $self = shift;
- local $_ = shift;
- my $par = "";
- my $indent_space = " " x $self->{INDENT};
- my $marg = $self->{SCREEN} - $self->{INDENT};
- my $line = $indent_space;
- my $line_length;
- foreach (split) {
- my $word_length = length;
- $word_length -= 2 while /\010/g; # Subtract backspaces
-
- if ($line_length + $word_length > $marg) {
- $par .= $line . "\n";
- $line= $indent_space . $_;
- $line_length = $word_length;
- }
- else {
- if ($line_length) {
- $line_length++;
- $line .= " ";
- }
- $line_length += $word_length;
- $line .= $_;
- }
- }
- $par .= "$line\n" if length $line;
- $par .= "\n";
- return $par;
-}
-
-## Handle a pending "item" paragraph. The paragraph (if given) is the
-## corresponding item text. (the item tag should be in $self->{ITEM}).
-sub item {
- my $self = shift;
- my $cmd = shift;
- local $_ = shift;
- my $line = shift;
- $cmd = '' unless (defined $cmd);
- $_ = '' unless (defined $_);
- my $out_fh = $self->output_handle();
- return unless (defined $self->{ITEM});
- my $paratag = $self->{ITEM};
- my $prev_indent = $self->{INDENTS}->[-1] || $self->{DEF_INDENT};
- ## reset state
- undef $self->{ITEM};
- #$self->rm_callbacks('*');
-
- my $over = $self->{INDENT};
- $over -= $prev_indent if ($prev_indent < $over);
- if (length $cmd) { # tricked - this is another command
- $self->output($paratag, INDENT => $prev_indent);
- $self->command($cmd, $_);
- }
- elsif (/^\s+/o) { # verbatim
- $self->output($paratag, INDENT => $prev_indent);
- s/\s+\Z//;
- $self->verbatim($_);
- }
- else { # plain textblock
- $_ = $self->interpolate($_, $line);
- s/\s+\Z//;
- if ((length $_) && (length($paratag) <= $over)) {
- $self->IP_output($paratag, $_);
- }
- else {
- $self->output($paratag, INDENT => $prev_indent);
- $self->output($_, REFORMAT => 1);
- }
- }
-}
-
-sub remap_whitespace {
- my $self = shift;
- local($_) = shift;
- tr/\000-\177/\200-\377/;
- return $_;
-}
-
-sub unmap_whitespace {
- my $self = shift;
- local($_) = shift;
- tr/\200-\377/\000-\177/;
- return $_;
-}
-
-sub IP_output {
- my $self = shift;
- my $tag = shift;
- local($_) = @_;
- my $out_fh = $self->output_handle();
- my $tag_indent = $self->{INDENTS}->[-1] || $self->{DEF_INDENT};
- my $tag_cols = $self->{SCREEN} - $tag_indent;
- my $cols = $self->{SCREEN} - $self->{INDENT};
- $tag =~ s/\s*$//;
- s/\s+/ /g;
- s/^ //;
- my $fmt_name = '_Pod_Text_IP_output_format_';
- my $str = "format $fmt_name = \n"
- . (" " x ($tag_indent))
- . '@' . ('<' x ($self->{INDENT} - $tag_indent - 1))
- . "^" . ("<" x ($cols - 1)) . "\n"
- . '$tag, $_'
- . "\n~~"
- . (" " x ($self->{INDENT} - 2))
- . "^" . ("<" x ($cols - 5)) . "\n"
- . '$_' . "\n\n.\n1";
- #warn $str; warn "tag is $tag, _ is $_";
- {
- ## reset format (turn off warning about redefining a format)
- local($^W) = 0;
- eval $str;
- croak if ($@);
- }
- select((select($out_fh), $~ = $fmt_name)[0]);
- local($:) = ($self->curr_headings(1) eq 'SYNOPSIS') ? "\n " : $: ;
- write $out_fh;
-}
-
-sub output {
- my $self = shift;
- local $_ = shift;
- $_ = '' unless (defined $_);
- return unless (length $_);
- my $out_fh = $self->output_handle();
- my %options;
- if (@_ > 1) {
- ## usage was $self->output($text, NAME=>VALUE, ...);
- %options = @_;
- }
- elsif (@_ == 1) {
- if (ref $_[0]) {
- ## usage was $self->output($text, { NAME=>VALUE, ... } );
- %options = %{$_[0]};
- }
- else {
- ## usage was $self->output($text, $number);
- $options{"REFORMAT"} = shift;
- }
- }
- $options{"INDENT"} = $self->{INDENT} unless (defined $options{"INDENT"});
- if ((defined $options{"REFORMAT"}) && $options{"REFORMAT"}) {
- my $cols = $self->{SCREEN} - $options{"INDENT"};
- s/\s+/ /g;
- s/^ //;
- my $fmt_name = '_Pod_Text_output_format_';
- my $str = "format $fmt_name = \n~~"
- . (" " x ($options{"INDENT"} - 2))
- . "^" . ("<" x ($cols - 5)) . "\n"
- . '$_' . "\n\n.\n1";
- {
- ## reset format (turn off warning about redefining a format)
- local($^W) = 0;
- eval $str;
- croak if ($@);
- }
- select((select($out_fh), $~ = $fmt_name)[0]);
- local($:) = ($self->curr_headings(1) eq 'SYNOPSIS') ? "\n " : $: ;
- write $out_fh;
- }
- else {
- s/^/' ' x $options{"INDENT"}/gem;
- s/^\s+\n$/\n/gm;
- print $out_fh $_;
- }
-}
-
-sub internal_lrefs {
- my $self = shift;
- local $_ = shift;
- s{L</([^>]+)>}{$1}g;
- my(@items) = split( /(?:,?\s+(?:and\s+)?)/ );
- my $retstr = "the ";
- my $i;
- for ($i = 0; $i <= $#items; $i++) {
- $retstr .= "C<$items[$i]>";
- $retstr .= ", " if @items > 2 && $i != $#items;
- $retstr .= " and " if $i+2 == @items;
- }
-
- $retstr .= " entr" . ( @items > 1 ? "ies" : "y" )
- . " elsewhere in this document ";
-
- return $retstr;
-}
-
-sub begin_pod {
- my $self = shift;
-
- $self->{BEGUN} = [];
- $self->{TERMCAP} = 0;
- #$self->{USE_FORMAT} = 1;
-
- $self->{FONTMAP} = {
- UNDL => "\x1b[4m",
- INV => "\x1b[7m",
- BOLD => "\x1b[1m",
- NORM => "\x1b[0m",
- };
- if ($self->{TERMCAP} and (! defined $self->{SETUPTERMCAP})) {
- $self->{SETUPTERMCAP} = 1;
- my ($term) = Tgetent Term::Cap { TERM => undef, OSPEED => 9600 };
- $self->{FONTMAP}->{UNDL} = $term->{'_us'};
- $self->{FONTMAP}->{INV} = $term->{'_mr'};
- $self->{FONTMAP}->{BOLD} = $term->{'_md'};
- $self->{FONTMAP}->{NORM} = $term->{'_me'};
- }
-
- $self->{SCREEN} = &get_screen;
- $self->{FANCY} = 0;
- $self->{DEF_INDENT} = 4;
- $self->{INDENTS} = [];
- $self->{INDENT} = $self->{DEF_INDENT};
- $self->{NEEDSPACE} = 0;
-}
-
-sub end_pod {
- my $self = shift;
- $self->item('', '', '', 0) if (defined $self->{ITEM});
-}
-
-sub begun_excluded {
- my $self = shift;
- my @begun = @{ $self->{BEGUN} };
- return (@begun > 0) ? ($begun[-1] ne 'text') : 0;
-}
-
-sub command {
- my $self = shift;
- my $cmd = shift;
- local $_ = shift;
- my $line = shift;
- $cmd = '' unless (defined $cmd);
- $_ = '' unless (defined $_);
- my $out_fh = $self->output_handle();
-
- return if (($cmd ne 'end') and $self->begun_excluded());
- return $self->item($cmd, $_, $line) if (defined $self->{ITEM});
- $_ = $self->interpolate($_, $line);
- s/\s+\Z/\n/;
-
- return if ($cmd eq 'pod');
- if ($cmd eq 'head1') {
- $self->makespace();
- print $out_fh $_;
- # print $out_fh uc($_);
- }
- elsif ($cmd eq 'head2') {
- $self->makespace();
- # s/(\w+)/\u\L$1/g;
- #print ' ' x $self->{DEF_INDENT}, $_;
- # print "\xA7";
- s/(\w)/\xA7 $1/ if $self->{FANCY};
- print $out_fh ' ' x ($self->{DEF_INDENT}/2), $_, "\n";
- }
- elsif ($cmd eq 'over') {
- /^[-+]?\d+$/ or $_ = $self->{DEF_INDENT};
- push(@{$self->{INDENTS}}, $self->{INDENT});
- $self->{INDENT} += ($_ + 0);
- }
- elsif ($cmd eq 'back') {
- $self->{INDENT} = pop(@{$self->{INDENTS}});
- unless (defined $self->{INDENT}) {
- carp "Unmatched =back\n";
- $self->{INDENT} = $self->{DEF_INDENT};
- }
- }
- elsif ($cmd eq 'begin') {
- my ($kind) = /^(\S*)/;
- push( @{ $self->{BEGUN} }, $kind );
- }
- elsif ($cmd eq 'end') {
- pop( @{ $self->{BEGUN} } );
- }
- elsif ($cmd eq 'for') {
- $self->textblock($1) if /^text\b\s*(.*)$/s;
- }
- elsif ($cmd eq 'item') {
- $self->makespace();
- # s/\A(\s*)\*/$1\xb7/ if $self->{FANCY};
- # s/^(\s*\*\s+)/$1 /;
- $self->{ITEM} = $_;
- #$self->add_callbacks('*', SUB => \&item);
- }
- else {
- carp "Unrecognized directive: $cmd\n";
- }
-}
-
-sub verbatim {
- my $self = shift;
- local $_ = shift;
- my $line = shift;
- return if $self->begun_excluded();
- return $self->item('', $_, $line) if (defined $self->{ITEM});
- $self->output($_);
- #$self->{NEEDSPACE} = 1;
-}
-
-sub textblock {
- my $self = shift;
- my $text = shift;
- my $line = shift;
- return if $self->begun_excluded();
- return $self->item('', $text, $line) if (defined $self->{ITEM});
- local($_) = $self->interpolate($text, $line);
- s/\s*\Z/\n/;
- $self->makespace();
- $self->output($_, REFORMAT => 1);
-}
-
-sub interior_sequence {
- my $self = shift;
- my $cmd = shift;
- my $arg = shift;
- local($_) = $arg;
- if ($cmd eq 'C') {
- my ($pre, $post) = ("`", "'");
- ($pre, $post) = ($HTML_Escapes{"lchevron"}, $HTML_Escapes{"rchevron"})
- if ((defined $self->{FANCY}) && $self->{FANCY});
- $_ = $pre . $_ . $post;
- }
- elsif ($cmd eq 'E') {
- if (defined $HTML_Escapes{$_}) {
- $_ = $HTML_Escapes{$_};
- }
- else {
- carp "Unknown escape: E<$_>";
- $_ = "E<$_>";
- }
- # }
- # elsif ($cmd eq 'B') {
- # $_ = $self->bold($_);
- }
- elsif ($cmd eq 'I') {
- # $_ = $self->italic($_);
- $_ = "*" . $_ . "*";
- }
- elsif (($cmd eq 'X') || ($cmd eq 'Z')) {
- $_ = '';
- }
- elsif ($cmd eq 'S') {
- # Escape whitespace until we are ready to print
- #$_ = $self->remap_whitespace($_);
- }
- elsif ($cmd eq 'L') {
- s/\s+/ /g;
- my ($text, $manpage, $sec, $ref) = ('', $_, '', '');
- if (/\A(.*?)\|(.*)\Z/) {
- $text = $1;
- $manpage = $_ = $2;
- }
- if (/^\s*"\s*(.*)\s*"\s*$/o) {
- ($manpage, $sec) = ('', "\"$1\"");
- }
- elsif (m|\s*/\s*|s) {
- ($manpage, $sec) = split(/\s*\/\s*/, $_, 2);
- }
- if (! length $sec) {
- $ref .= "the $manpage manpage" if (length $manpage);
- }
- elsif ($sec =~ /^\s*"\s*(.*)\s*"\s*$/o) {
- $ref .= "the section on \"$1\"";
- $ref .= " in the $manpage manpage" if (length $manpage);
- }
- else {
- $ref .= "the \"$sec\" entry";
- $ref .= (length $manpage) ? " in the $manpage manpage"
- : " in this manpage"
- }
- $_ = $text || $ref;
- #if ( m{^ ([a-zA-Z][^\s\/]+) (\([^\)]+\))? $}x ) {
- # ## LREF: a manpage(3f)
- # $_ = "the $1$2 manpage";
- #}
- #elsif ( m{^ ([^/]+) / ([:\w]+(\(\))?) $}x ) {
- # ## LREF: an =item on another manpage
- # $_ = "the \"$2\" entry in the $1 manpage";
- #}
- #elsif ( m{^ / ([:\w]+(\(\))?) $}x ) {
- # ## LREF: an =item on this manpage
- # $_ = $self->internal_lrefs($1);
- #}
- #elsif ( m{^ (?: ([a-zA-Z]\S+?) / )? "?(.*?)"? $}x ) {
- # ## LREF: a =head2 (head1?), maybe on a manpage, maybe right here
- # ## the "func" can disambiguate
- # $_ = ((defined $1) && $1)
- # ? "the section on \"$2\" in the $1 manpage"
- # : "the section on \"$2\"";
- #}
- }
- return $_;
-}
-
-1;
diff --git a/lib/Pod/Select.pm b/lib/Pod/Select.pm
index 26cbe021ed..b933cc2cdf 100644
--- a/lib/Pod/Select.pm
+++ b/lib/Pod/Select.pm
@@ -1,10 +1,7 @@
#############################################################################
# Pod/Select.pm -- function to select portions of POD docs
#
-# Based on Tom Christiansen's pod2text() function
-# (with extensive modifications).
-#
-# Copyright (C) 1996-1999 Tom Christiansen. All rights reserved.
+# Copyright (C) 1996-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
@@ -13,7 +10,7 @@
package Pod::Select;
use vars qw($VERSION);
-$VERSION = 1.081; ## Current version of this package
+$VERSION = 1.085; ## Current version of this package
require 5.004; ## requires this Perl version or later
#############################################################################
diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm
index 88c594fdd4..165dd5db16 100644
--- a/lib/Pod/Text.pm
+++ b/lib/Pod/Text.pm
@@ -1,16 +1,15 @@
# Pod::Text -- Convert POD data to formatted ASCII text.
-# $Id: Text.pm,v 0.2 1999/06/13 02:44:01 eagle Exp $
+# $Id: Text.pm,v 2.1 1999/09/20 11:53:33 eagle Exp $
#
# Copyright 1999 by Russ Allbery <rra@stanford.edu>
#
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
-# This module may potentially be a replacement for Pod::Text, although it
-# does not (at the current time) attempt to match the output of Pod::Text
-# and makes several different formatting choices (mostly in the direction of
-# less markup). It uses Pod::Parser and is designed to be very easy to
-# subclass.
+# This module is intended to be a replacement for Pod::Text, and attempts to
+# match its output except for some specific circumstances where other
+# decisions seemed to produce better output. It uses Pod::Parser and is
+# designed to be very easy to subclass.
############################################################################
# Modules and declarations
@@ -20,15 +19,17 @@ package Pod::Text;
require 5.004;
-use Carp qw(carp);
-use Pod::Parser ();
+use Carp qw(carp croak);
+use Pod::Select ();
use strict;
use vars qw(@ISA %ESCAPES $VERSION);
-@ISA = qw(Pod::Parser);
+# We inherit from Pod::Select instead of Pod::Parser so that we can be used
+# by Pod::Usage.
+@ISA = qw(Pod::Select);
-$VERSION = '0.01';
+($VERSION = (split (' ', q$Revision: 2.1 $ ))[1]) =~ s/\.(\d)$/.0$1/;
############################################################################
@@ -36,8 +37,8 @@ $VERSION = '0.01';
############################################################################
# This table is taken near verbatim from Pod::PlainText in Pod::Parser,
-# which got it near verbatim from Pod::Text. It is therefore credited to
-# Tom Christiansen, and I'm glad I didn't have to write it. :)
+# which got it near verbatim from the original Pod::Text. It is therefore
+# credited to Tom Christiansen, and I'm glad I didn't have to write it. :)
%ESCAPES = (
'amp' => '&', # ampersand
'lt' => '<', # left chevron, less-than
@@ -126,7 +127,6 @@ sub initialize {
$$self{sentence} = 0 unless defined $$self{sentence};
$$self{width} = 76 unless defined $$self{width};
- $$self{BEGUN} = []; # Stack of =begin blocks.
$$self{INDENTS} = []; # Stack of indentations.
$$self{MARGIN} = $$self{indent}; # Current left margin in spaces.
@@ -168,14 +168,16 @@ sub verbatim {
# Called for a regular text block. Gets the paragraph, the line number, and
# a Pod::Paragraph object. Perform interpolation and output the results.
sub textblock {
- my ($self, $text, $line) = @_;
+ my $self = shift;
return if $$self{EXCLUDE};
- local $_ = $text;
+ $self->output ($_[0]), return if $$self{VERBATIM};
+ local $_ = shift;
+ my $line = shift;
# Perform a little magic to collapse multiple L<> references. This is
- # here mostly for backwards-compatibility with Pod::Text. We'll just
- # rewrite the whole thing into actual text at this part, bypassing the
- # whole internal sequence parsing thing.
+ # here mostly for backwards-compatibility. We'll just rewrite the whole
+ # thing into actual text at this part, bypassing the whole internal
+ # sequence parsing thing.
s{
(
L< # A link of the form L</something>.
@@ -239,7 +241,7 @@ sub interior_sequence {
}
# For all the other sequences, empty content produces no output.
- return unless $_;
+ return if $_ eq '';
# For S<>, compress all internal whitespace and then map spaces to \01.
# When we output the text, we'll map this back.
@@ -279,6 +281,7 @@ sub cmd_head1 {
my $self = shift;
local $_ = shift;
s/\s+$//;
+ $_ = $self->interpolate ($_, shift);
if ($$self{alt}) {
$self->output ("\n==== $_ ====\n\n");
} else {
@@ -292,6 +295,7 @@ sub cmd_head2 {
my $self = shift;
local $_ = shift;
s/\s+$//;
+ $_ = $self->interpolate ($_, shift);
if ($$self{alt}) {
$self->output ("\n== $_ ==\n\n");
} else {
@@ -327,38 +331,35 @@ sub cmd_item {
$$self{ITEM} = $self->interpolate ($_);
}
-# Begin a block for a particular translator. To allow for weird nested
-# =begin blocks, keep track of how many blocks we were excluded from and
-# only unwind one level with each =end.
+# Begin a block for a particular translator. Setting VERBATIM triggers
+# special handling in textblock().
sub cmd_begin {
my $self = shift;
local $_ = shift;
my ($kind) = /^(\S+)/ or return;
- push (@{ $$self{BEGUN} }, $kind);
- $$self{EXCLUDE}++ unless $kind eq 'text';
+ if ($kind eq 'text') {
+ $$self{VERBATIM} = 1;
+ } else {
+ $$self{EXCLUDE} = 1;
+ }
}
# End a block for a particular translator. We assume that all =begin/=end
-# pairs are properly nested and just pop the previous one.
+# pairs are properly closed.
sub cmd_end {
my $self = shift;
- my $kind = pop @{ $$self{BEGUN} };
- $$self{EXCLUDE}-- if $$self{EXCLUDE};
+ $$self{EXCLUDE} = 0;
+ $$self{VERBATIM} = 0;
}
# One paragraph for a particular translator. Ignore it unless it's intended
-# for text, in which case we treat it as either a normal text block or a
-# verbatim text block, depending on whether it's indented.
+# for text, in which case we treat it as a verbatim text block.
sub cmd_for {
my $self = shift;
local $_ = shift;
my $line = shift;
- return unless s/^text\b[ \t]*//;
- if (/^\n\s+/) {
- $self->verbatim ($_, $line);
- } else {
- $self->textblock ($_, $line);
- }
+ return unless s/^text\b[ \t]*\n?//;
+ $self->verbatim ($_, $line);
}
@@ -368,9 +369,9 @@ sub cmd_for {
# The simple formatting ones. These are here mostly so that subclasses can
# override them and do more complicated things.
-sub seq_b { my $self = shift; return $$self{alt} ? "``$_[0]''" : $_[0] }
-sub seq_c { my $self = shift; return $$self{alt} ? "``$_[0]''" : "`$_[0]'" }
-sub seq_f { my $self = shift; return $$self{alt} ? "\"$_[0]\"" : $_[0] }
+sub seq_b { return $_[0]{alt} ? "``$_[1]''" : $_[1] }
+sub seq_c { return $_[0]{alt} ? "``$_[1]''" : "`$_[1]'" }
+sub seq_f { return $_[0]{alt} ? "\"$_[1]\"" : $_[1] }
sub seq_i { return '*' . $_[1] . '*' }
# The complicated one. Handle links. Since this is plain text, we can't
@@ -389,7 +390,6 @@ sub seq_l {
# Okay, leading and trailing whitespace isn't important; get rid of it.
s/^\s+//;
s/\s+$//;
- chomp;
# Default to using the whole content of the link entry as a section
# name. Note that L<manpage/> forces a manpage interpretation, as does
@@ -447,7 +447,12 @@ sub item {
my $space = ' ' x $indent;
$space =~ s/^ /:/ if $$self{alt};
if (!$_ || /^\s+$/ || ($$self{MARGIN} - $indent < length ($tag) + 1)) {
- $self->output ($space . $tag . "\n");
+ my $margin = $$self{MARGIN};
+ $$self{MARGIN} = $indent;
+ my $output = $self->reformat ($tag);
+ $output =~ s/\n*$/\n/;
+ $self->output ($output);
+ $$self{MARGIN} = $margin;
$self->output ($self->reformat ($_)) if /\S/;
} else {
$_ = $self->reformat ($_);
@@ -509,6 +514,49 @@ sub output { $_[1] =~ tr/\01/ /; print { $_[0]->output_handle } $_[1] }
############################################################################
+# Backwards compatibility
+############################################################################
+
+# The old Pod::Text module did everything in a pod2text() function. This
+# tries to provide the same interface for legacy applications.
+sub pod2text {
+ my @args;
+
+ # This is really ugly; I hate doing option parsing in the middle of a
+ # module. But the old Pod::Text module supported passing flags to its
+ # entry function, so handle -a and -<number>.
+ while ($_[0] =~ /^-/) {
+ my $flag = shift;
+ if ($flag eq '-a') { push (@args, alt => 1) }
+ elsif ($flag =~ /^-(\d+)$/) { push (@args, width => $1) }
+ else {
+ unshift (@_, $flag);
+ last;
+ }
+ }
+
+ # Now that we know what arguments we're using, create the parser.
+ my $parser = Pod::Text->new (@args);
+
+ # If two arguments were given, the second argument is going to be a file
+ # handle. That means we want to call parse_from_filehandle(), which
+ # means we need to turn the first argument into a file handle. Magic
+ # open will handle the <&STDIN case automagically.
+ if (defined $_[1]) {
+ local *IN;
+ unless (open (IN, $_[0])) {
+ croak ("Can't open $_[0] for reading: $!\n");
+ return;
+ }
+ $_[0] = \*IN;
+ return $parser->parse_from_filehandle (@_);
+ } else {
+ return $parser->parse_from_file (@_);
+ }
+}
+
+
+############################################################################
# Module return value and documentation
############################################################################
@@ -532,17 +580,17 @@ Pod::Text - Convert POD data to formatted ASCII text
=head1 DESCRIPTION
-Pod::Text is a module that can convert documentation in the POD format
-(such as can be found throughout the Perl distribution) into formatted
-ASCII. It uses no special formatting controls or codes whatsoever, and its
-output is therefore suitable for nearly any device.
+Pod::Text is a module that can convert documentation in the POD format (the
+preferred language for documenting Perl) into formatted ASCII. It uses no
+special formatting controls or codes whatsoever, and its output is therefore
+suitable for nearly any device.
-As a derived class from Pod::Parser, Pod::Text supports the same
-methods and interfaces. See L<Pod::Parser> for all the details; briefly,
-one creates a new parser with C<Pod::Text-E<gt>new()> and then calls
-either C<parse_from_filehandle()> or C<parse_from_file()>.
+As a derived class from Pod::Parser, Pod::Text supports the same methods and
+interfaces. See L<Pod::Parser> for all the details; briefly, one creates a
+new parser with C<Pod::Text-E<gt>new()> and then calls either
+parse_from_filehandle() or parse_from_file().
-C<new()> can take options, in the form of key/value pairs, that control the
+new() can take options, in the form of key/value pairs, that control the
behavior of the parser. The currently recognized options are:
=over 4
@@ -569,8 +617,8 @@ output.
=item sentence
-If set to a true value, Pod::Text will assume that each sentence ends
-in two spaces, and will try to preserve that spacing. If set to false, all
+If set to a true value, Pod::Text will assume that each sentence ends in two
+spaces, and will try to preserve that spacing. If set to false, all
consecutive whitespace in non-verbatim paragraphs is compressed into a
single space. Defaults to true.
@@ -580,49 +628,67 @@ The column at which to wrap text on the right-hand side. Defaults to 76.
=back
-The standard Pod::Parser method C<parse_from_filehandle()> takes up to two
+The standard Pod::Parser method parse_from_filehandle() takes up to two
arguments, the first being the file handle to read POD from and the second
being the file handle to write the formatted output to. The first defaults
to STDIN if not given, and the second defaults to STDOUT. The method
-C<parse_from_file()> is almost identical, except that its two arguments are
-the input and output disk files instead. See L<Pod::Parser> for the
-specific details.
+parse_from_file() is almost identical, except that its two arguments are the
+input and output disk files instead. See L<Pod::Parser> for the specific
+details.
=head1 DIAGNOSTICS
=over 4
+=item Bizarre space in item
+
+(W) Something has gone wrong in internal C<=item> processing. This message
+indicates a bug in Pod::Text; you should never see it.
+
+=item Can't open %s for reading: %s
+
+(F) Pod::Text was invoked via the compatibility mode pod2text() interface
+and the input file it was given could not be opened.
+
=item Unknown escape: %s
-The POD source contained an C<EE<lt>E<gt>> escape that Pod::Text
-didn't know about.
+(W) The POD source contained an C<EE<lt>E<gt>> escape that Pod::Text didn't
+know about.
=item Unknown sequence: %s
-The POD source contained a non-standard internal sequence (something of the
-form C<XE<lt>E<gt>>) that Pod::Text didn't know about.
+(W) The POD source contained a non-standard internal sequence (something of
+the form C<XE<lt>E<gt>>) that Pod::Text didn't know about.
=item Unmatched =back
-Pod::Text encountered a C<=back> command that didn't correspond to an
+(W) Pod::Text encountered a C<=back> command that didn't correspond to an
C<=over> command.
=back
+=head1 RESTRICTIONS
+
+Embedded Ctrl-As (octal 001) in the input will be mapped to spaces on
+output, due to an internal implementation detail.
+
=head1 NOTES
-I'm hoping this module will eventually replace Pod::Text in Perl core once
-Pod::Parser has been added to Perl core. Accordingly, don't be surprised if
-the name of this module changes to Pod::Text down the road.
+This is a replacement for an earlier Pod::Text module written by Tom
+Christiansen. It has a revamped interface, since it now uses Pod::Parser,
+but an interface roughly compatible with the old Pod::Text::pod2text()
+function is still available. Please change to the new calling convention,
+though.
The original Pod::Text contained code to do formatting via termcap
sequences, although it wasn't turned on by default and it was problematic to
-get it to work at all. This module doesn't even try to do that, but a
-subclass of it does. Look for Pod::Text::Termcap.
+get it to work at all. This rewrite doesn't even try to do that, but a
+subclass of it does. Look for L<Pod::Text::Termcap|Pod::Text::Termcap>.
=head1 SEE ALSO
-L<Pod::Parser|Pod::Parser>, L<Pod::Text::Termcap|Pod::Text::Termcap>
+L<Pod::Parser|Pod::Parser>, L<Pod::Text::Termcap|Pod::Text::Termcap>,
+pod2text(1)
=head1 AUTHOR
diff --git a/lib/Pod/Text/Color.pm b/lib/Pod/Text/Color.pm
index 5eac57ca9f..10e1d9fa30 100644
--- a/lib/Pod/Text/Color.pm
+++ b/lib/Pod/Text/Color.pm
@@ -1,5 +1,5 @@
# Pod::Text::Color -- Convert POD data to formatted color ASCII text
-# $Id: Color.pm,v 0.1 1999/06/13 02:41:06 eagle Exp $
+# $Id: Color.pm,v 0.5 1999/09/20 10:15:16 eagle Exp $
#
# Copyright 1999 by Russ Allbery <rra@stanford.edu>
#
@@ -27,7 +27,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
# Use the CVS revision of this file as its version number.
-($VERSION = (split (' ', q$Revision: 0.1 $ ))[1]) =~ s/\.(\d)$/.0$1/;
+($VERSION = (split (' ', q$Revision: 0.5 $ ))[1]) =~ s/\.(\d)$/.0$1/;
############################################################################
@@ -100,10 +100,19 @@ Pod::Text::Color - Convert POD data to formatted color ASCII text
=head1 DESCRIPTION
-Pod::Text::Color is a simple subclass of Pod::Text that highlights
-output text using ANSI color escape sequences. Apart from the color, it in
-all ways functions like Pod::Text. See L<Pod::Text> for details
-and available options.
+Pod::Text::Color is a simple subclass of Pod::Text that highlights output
+text using ANSI color escape sequences. Apart from the color, it in all
+ways functions like Pod::Text. See L<Pod::Text> for details and available
+options.
+
+Term::ANSIColor is used to get colors and therefore must be installed to use
+this module.
+
+=head1 BUGS
+
+This is just a basic proof of concept. It should be seriously expanded to
+support configurable coloration via options passed to the constructor, and
+B<pod2text> should be taught about those.
=head1 SEE ALSO
diff --git a/lib/Pod/Text/Termcap.pm b/lib/Pod/Text/Termcap.pm
index efb71a69ba..7e89ec61be 100644
--- a/lib/Pod/Text/Termcap.pm
+++ b/lib/Pod/Text/Termcap.pm
@@ -1,14 +1,14 @@
# Pod::Text::Termcap -- Convert POD data to ASCII text with format escapes.
-# $Id: Termcap.pm,v 0.1 1999/06/13 02:41:06 eagle Exp $
+# $Id: Termcap.pm,v 0.4 1999/09/20 10:17:45 eagle Exp $
#
# Copyright 1999 by Russ Allbery <rra@stanford.edu>
#
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
-# This is a simple subclass of Pod::Text that overrides a few key
-# methods to output the right termcap escape sequences for formatted text
-# on the current terminal type.
+# This is a simple subclass of Pod::Text that overrides a few key methods to
+# output the right termcap escape sequences for formatted text on the
+# current terminal type.
############################################################################
# Modules and declarations
@@ -21,13 +21,14 @@ require 5.004;
use Pod::Text ();
use POSIX ();
use Term::Cap;
+
use strict;
use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
# Use the CVS revision of this file as its version number.
-($VERSION = (split (' ', q$Revision: 0.1 $ ))[1]) =~ s/\.(\d)$/.0$1/;
+($VERSION = (split (' ', q$Revision: 0.4 $ ))[1]) =~ s/\.(\d)$/.0$1/;
############################################################################
@@ -125,10 +126,10 @@ Pod::Text::Color - Convert POD data to ASCII text with format escapes
=head1 DESCRIPTION
-Pod::Text::Termcap is a simple subclass of Pod::Text that highlights
-output text using the correct termcap escape sequences for the current
-terminal. Apart from the format codes, it in all ways functions like
-Pod::Text. See L<Pod::Text> for details and available options.
+Pod::Text::Termcap is a simple subclass of Pod::Text that highlights output
+text using the correct termcap escape sequences for the current terminal.
+Apart from the format codes, it in all ways functions like Pod::Text. See
+L<Pod::Text> for details and available options.
=head1 SEE ALSO
diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm
index 9cb71e0afa..18fa22598f 100644
--- a/lib/Pod/Usage.pm
+++ b/lib/Pod/Usage.pm
@@ -1,10 +1,7 @@
#############################################################################
# Pod/Usage.pm -- print usage messages for the running script.
#
-# Based on Tom Christiansen's Pod::Text::pod2text() function
-# (with modifications).
-#
-# Copyright (C) 1994-1999 Tom Christiansen. All rights reserved.
+# Copyright (C) 1996-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
@@ -13,7 +10,7 @@
package Pod::Usage;
use vars qw($VERSION);
-$VERSION = 1.081; ## Current version of this package
+$VERSION = 1.085; ## Current version of this package
require 5.004; ## requires this Perl version or later
=head1 NAME
@@ -363,12 +360,21 @@ use strict;
#use diagnostics;
use Carp;
use Exporter;
-use Pod::PlainText;
use File::Spec;
use vars qw(@ISA @EXPORT);
-@ISA = qw(Pod::PlainText);
@EXPORT = qw(&pod2usage);
+BEGIN {
+ if ( $] >= 5.005_58 ) {
+ require Pod::Text;
+ @ISA = qw( Pod::Text );
+ }
+ else {
+ require Pod::PlainText;
+ @ISA = qw( Pod::PlainText );
+ }
+}
+
##---------------------------------------------------------------------------
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 82c052148b..a09c6e5d46 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -2149,6 +2149,10 @@ C<last> cannot be used to exit a block which returns a value such as
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
+Note that a block by itself is semantically identical to a loop
+that executes once. Thus C<last> can be used to effect an early
+exit out of such a block.
+
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.
@@ -2394,6 +2398,9 @@ C<next> cannot be used to exit a block which returns a value such as
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
+Note that a block by itself is semantically identical to a loop
+that executes once. Thus C<next> will exit such a block early.
+
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.
@@ -3285,6 +3292,10 @@ C<redo> cannot be used to retry a block which returns a value such as
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
+Note that a block by itself is semantically identical to a loop
+that executes once. Thus C<redo> inside such a block will effectively
+turn it into a looping construct.
+
See also L</continue> for an illustration of how C<last>, C<next>, and
C<redo> work.
diff --git a/pod/pod2man.PL b/pod/pod2man.PL
index 20610a84c3..68d0c42b1e 100644
--- a/pod/pod2man.PL
+++ b/pod/pod2man.PL
@@ -9,7 +9,6 @@ use Cwd;
# have to mention them as if they were shell variables, not
# %Config entries. Thus you write
# $startperl
-# $man3ext
# to ensure Configure will look for $Config{startperl}.
# This forces PL files to create target in same directory as PL file.
@@ -29,1206 +28,440 @@ print "Extracting $file (with variable substitutions)\n";
print OUT <<"!GROK!THIS!";
$Config{startperl}
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
- if \$running_under_some_shell;
-
-\$DEF_PM_SECTION = '$Config{man3ext}' || '3';
+ if \$running_under_some_shell;
!GROK!THIS!
# In the following, perl variables are not expanded during extraction.
print OUT <<'!NO!SUBS!';
-=head1 NAME
-
-pod2man - translate embedded Perl pod directives into man pages
-
-=head1 SYNOPSIS
-
-B<pod2man>
-[ B<--section=>I<manext> ]
-[ B<--release=>I<relpatch> ]
-[ B<--center=>I<string> ]
-[ B<--date=>I<string> ]
-[ B<--fixed=>I<font> ]
-[ B<--official> ]
-[ B<--lax> ]
-I<inputfile>
-
-=head1 DESCRIPTION
-
-B<pod2man> converts its input file containing embedded pod directives (see
-L<perlpod>) into nroff source suitable for viewing with nroff(1) or
-troff(1) using the man(7) macro set.
-
-Besides the obvious pod conversions, B<pod2man> also takes care of
-func(), func(n), and simple variable references like $foo or @bar so
-you don't have to use code escapes for them; complex expressions like
-C<$fred{'stuff'}> will still need to be escaped, though. Other nagging
-little roffish things that it catches include translating the minus in
-something like foo-bar, making a long dash--like this--into a real em
-dash, fixing up "paired quotes", putting a little space after the
-parens in something like func(), making C++ and PI look right, making
-double underbars have a little tiny space between them, making ALLCAPS
-a teeny bit smaller in troff(1), and escaping backslashes so you don't
-have to.
-
-=head1 OPTIONS
-
-=over 8
-
-=item center
-
-Set the centered header to a specific string. The default is
-"User Contributed Perl Documentation", unless the C<--official> flag is
-given, in which case the default is "Perl Programmers Reference Guide".
-
-=item date
-
-Set the left-hand footer string to this value. By default,
-the modification date of the input file will be used.
-
-=item fixed
-
-The fixed font to use for code refs. Defaults to CW.
-
-=item official
-
-Set the default header to indicate that this page is of
-the standard release in case C<--center> is not given.
-
-=item release
-
-Set the centered footer. By default, this is the current
-perl release.
-
-=item section
-
-Set the section for the C<.TH> macro. The standard conventions on
-sections are to use 1 for user commands, 2 for system calls, 3 for
-functions, 4 for devices, 5 for file formats, 6 for games, 7 for
-miscellaneous information, and 8 for administrator commands. This works
-best if you put your Perl man pages in a separate tree, like
-F</usr/local/perl/man/>. By default, section 1 will be used
-unless the file ends in F<.pm> in which case section 3 will be selected.
-
-=item lax
-
-Don't complain when required sections aren't present.
-
-=back
-
-=head1 Anatomy of a Proper Man Page
-
-For those not sure of the proper layout of a man page, here's
-an example of the skeleton of a proper man page. Head of the
-major headers should be setout as a C<=head1> directive, and
-are historically written in the rather startling ALL UPPER CASE
-format, although this is not mandatory.
-Minor headers may be included using C<=head2>, and are
-typically in mixed case.
-
-=over 10
-
-=item NAME
+# pod2man -- Convert POD data to formatted *roff input.
+#
+# Copyright 1999 by Russ Allbery <rra@stanford.edu>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the same terms as Perl itself.
+#
+# The driver script for Pod::Man. This script is expected to eventually
+# replace pod2man in the standard Perl distribution.
+
+require 5.004;
+
+use Getopt::Long qw(GetOptions);
+use Pod::Man ();
+use Pod::Usage qw(pod2usage);
+
+use strict;
+use vars;
+
+# Parse our options, trying to retain backwards compatibility with pod2man
+# but allowing short forms as well. --lax is currently ignored.
+my %options;
+Getopt::Long::config ('bundling');
+GetOptions (\%options, 'section|s=s', 'release|r=s', 'center|c=s',
+ 'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s',
+ 'fixedbolditalic=s', 'official|o', 'lax|l', 'help|h') or exit 1;
+pod2usage (0) if $options{help};
+
+# Official sets --center, but don't override things explicitly set.
+if ($options{official} && !defined $options{center}) {
+ $options{center} = 'Perl Programmers Reference Guide';
+}
-Mandatory section; should be a comma-separated list of programs or
-functions documented by this podpage, such as:
+# Initialize and run the formatter.
+my $parser = Pod::Man->new (\%options);
+$parser->parse_from_file (@ARGV);
- foo, bar - programs to do something
+__END__
-=item SYNOPSIS
+=head1 NAME
-A short usage summary for programs and functions, which
-may someday be deemed mandatory.
+pod2man - Convert POD data to formatted *roff input
-=item DESCRIPTION
+=head1 SYNOPSIS
-Long drawn out discussion of the program. It's a good idea to break this
-up into subsections using the C<=head2> directives, like
+pod2txt [B<--section>=I<manext>] [B<--release>=I<version>]
+[B<--center>=I<string>] [B<--date>=I<string>] [B<--fixed>=I<font>]
+[B<--fixedbold>=I<font>] [B<--fixeditalic>=I<font>]
+[B<--fixedbolditalic>=I<font>] [B<--official>] [B<--lax>] [I<input>
+[I<output>]]
- =head2 A Sample Subection
+pod2txt B<--help>
- =head2 Yet Another Sample Subection
+=head1 DESCRIPTION
-=item OPTIONS
+B<pod2man> is a front-end for Pod::Man, using it to generate *roff input
+from POD source. The resulting *roff code is suitable for display on a
+terminal using nroff(1), normally via man(1), or printing using troff(1).
+
+I<input> is the file to read for POD source (the POD can be embedded in
+code). If I<input> isn't given, it defaults to STDIN. I<output>, if given,
+is the file to which to write the formatted output. If I<output> isn't
+given, the formatted output is written to STDOUT.
+
+B<--section>, B<--release>, B<--center>, B<--date>, and B<--official> can be
+used to set the headers and footers to use; if not given, Pod::Man will
+assume various defaults. See below or L<Pod::Man> for details.
+
+B<pod2man> assumes that your *roff formatters have a fixed-width font named
+CW. If yours is called something else (like CR), use B<--fixed> to specify
+it. This generally only matters for troff output for printing. Similarly,
+you can set the fonts used for bold, italic, and bold italic fixed-width
+output.
+
+Besides the obvious pod conversions, Pod::Man, and therefore pod2man also
+takes care of formatting func(), func(n), and simple variable references
+like $foo or @bar so you don't have to use code escapes for them; complex
+expressions like C<$fred{'stuff'}> will still need to be escaped, though.
+It also translates dashes that aren't used as hyphens into en dashes, makes
+long dashes--like this--into proper em dashes, fixes "paired quotes," and
+takes care of several other troff-specific tweaks. See L<Pod::Man> for
+complete information.
-Some people make this separate from the description.
+=head1 OPTIONS
-=item RETURN VALUE
+=over 4
-What the program or function returns if successful.
+=item B<-c> I<string>, B<--center>=I<string>
-=item ERRORS
+Sets the centered page header to I<string>. The default is "User
+Contributed Perl Documentation", but also see B<--official> below.
-Exceptions, return codes, exit stati, and errno settings.
+=item B<-d> I<string>, B<--date>=I<string>
-=item EXAMPLES
+Set the left-hand footer string to this value. By default, the modification
+date of the input file will be used, or the current date if input comes from
+STDIN.
-Give some example uses of the program.
+=item B<--fixed>=I<font>
-=item ENVIRONMENT
+The fixed-width font to use for vertabim text and code. Defaults to CW.
+Some systems may want CR instead. Only matters for troff(1) output.
-Envariables this program might care about.
+=item B<--fixedbold>=I<font>
-=item FILES
+Bold version of the fixed-width font. Defaults to CB. Only matters for
+troff(1) output.
-All files used by the program. You should probably use the FE<lt>E<gt>
-for these.
+=item B<--fixeditalic>=I<font>
-=item SEE ALSO
+Italic version of the fixed-width font (actually, something of a misnomer,
+since most fixed-width fonts only have an oblique version, not an italic
+version). Defaults to CI. Only matters for troff(1) output.
-Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8).
+=item B<--fixedbolditalic>=I<font>
-=item NOTES
+Bold italic (probably actually oblique) version of the fixed-width font.
+Pod::Man doesn't assume you have this, and defaults to CB. Some systems
+(such as Solaris) have this font available as CX. Only matters for troff(1)
+output.
-Miscellaneous commentary.
+=item B<-h>, B<--help>
-=item CAVEATS
+Print out usage information.
-Things to take special care with; sometimes called WARNINGS.
+=item B<-l>, B<--lax>
-=item DIAGNOSTICS
+Don't complain when required sections are missing. Not currently used, as
+POD checking functionality is not yet implemented in Pod::Man.
-All possible messages the program can print out--and
-what they mean.
+=item B<-o>, B<--official>
-=item BUGS
+Set the default header to indicate that this page is part of the standard
+Perl release, if B<--center> is not also given.
-Things that are broken or just don't work quite right.
+=item B<-r>, B<--release>
-=item RESTRICTIONS
+Set the centered footer. By default, this is the version of Perl you run
+B<pod2man> under. Note that some system an macro sets assume that the
+centered footer will be a modification date and will prepend something like
+"Last modified: "; if this is the case, you may want to set B<--release> to
+the last modified date and B<--date> to the version number.
-Bugs you don't plan to fix :-)
+=item B<-s>, B<--section>
-=item AUTHOR
+Set the section for the C<.TH> macro. The standard section numbering
+convention is to use 1 for user commands, 2 for system calls, 3 for
+functions, 4 for devices, 5 for file formats, 6 for games, 7 for
+miscellaneous information, and 8 for administrator commands. There is a lot
+of variation here, however; some systems (like Solaris) use 4 for file
+formats, 5 for miscellaneous information, and 7 for devices. Still others
+use 1m instead of 8, or some mix of both. About the only section numbers
+that are reliably consistent are 1, 2, and 3.
-Who wrote it (or AUTHORS if multiple).
+By default, section 1 will be used unless the file ends in .pm in which case
+section 3 will be selected.
-=item HISTORY
+=back
-Programs derived from other sources sometimes have this, or
-you might keep a modification log here.
+=head1 DIAGNOSTICS
-=back
+If B<pod2man> fails with errors, see L<Pod::Man> and L<Pod::Parser> for
+information about what those errors might mean.
=head1 EXAMPLES
pod2man program > program.1
- pod2man some_module.pm > /usr/perl/man/man3/some_module.3
+ pod2man SomeModule.pm /usr/perl/man/man3/SomeModule.3
pod2man --section=7 note.pod > note.7
-=head1 DIAGNOSTICS
+If you would like to print out a lot of man page continuously, you probably
+want to set the C and D registers to set contiguous page numbering and
+even/odd paging, at least on some versions of man(7).
-The following diagnostics are generated by B<pod2man>. Items
-marked "(W)" are non-fatal, whereas the "(F)" errors will cause
-B<pod2man> to immediately exit with a non-zero status.
+ troff -man -rC1 -rD1 perl.1 perldata.1 perlsyn.1 ...
-=over 4
+To get index entries on stderr, turn on the F register, as in:
-=item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s>
+ troff -man -rF1 perl.1
-(W) If you start include an option, you should set it off
-as bold, italic, or code.
+The indexing merely outputs messages via C<.tm> for each major page,
+section, subsection, item, and any C<XE<lt>E<gt>> directives. See
+L<Pod::Man> for more details.
-=item can't open %s: %s
+=head1 BUGS
-(F) The input file wasn't available for the given reason.
+Lots of this documentation is duplicated from L<Pod::Man>.
-=item Improper man page - no dash in NAME header in paragraph %d of %s
+POD checking and the corresponding B<--lax> option don't work yet.
-(W) The NAME header did not have an isolated dash in it. This is
-considered important.
+=head1 NOTES
-=item Invalid man page - no NAME line in %s
+For those not sure of the proper layout of a man page, here are some notes
+on writing a proper man page.
-(F) You did not include a NAME header, which is essential.
+The name of the program being documented is conventionally written in bold
+(using BE<lt>E<gt>) wherever it occurs, as are all program options.
+Arguments should be written in italics (IE<lt>E<gt>). Functions are
+traditionally written in italics; if you write a function as function(),
+Pod::Man will take care of this for you. Literal code or commands should
+be in CE<lt>E<gt>. References to other man pages should be in the form
+C<manpage(section)>, and Pod::Man will automatically format those
+appropriately. As an exception, it's traditional not to use this form when
+referring to module documentation; use C<LE<lt>Module::NameE<gt>> instead.
-=item roff font should be 1 or 2 chars, not `%s' (F)
+References to other programs or functions are normally in the form of man
+page references so that cross-referencing tools can provide the user with
+links and the like. It's possible to overdo this, though, so be careful not
+to clutter your documentation with too much markup.
-(F) The font specified with the C<--fixed> option was not
-a one- or two-digit roff font.
+The major headers should be set out using a C<=head1> directive, and are
+historically written in the rather startling ALL UPPER CASE format, although
+this is not mandatory. Minor headers may be included using C<=head2>, and
+are typically in mixed case.
-=item %s is missing required section: %s
+The standard sections of a manual page are:
-(W) Required sections include NAME, DESCRIPTION, and if you're
-using a section starting with a 3, also a SYNOPSIS. Actually,
-not having a NAME is a fatal.
+=over 4
-=item Unknown escape: %s in %s
+=item NAME
-(W) An unknown HTML entity (probably for an 8-bit character) was given via
-a C<EE<lt>E<gt>> directive. Besides amp, lt, gt, and quot, recognized
-entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave,
-Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute,
-Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc,
-icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc,
-ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig,
-THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml,
-Yacute, yacute, and yuml.
+Mandatory section; should be a comma-separated list of programs or functions
+documented by this podpage, such as:
-=item Unmatched =back
+ foo, bar - programs to do something
-(W) You have a C<=back> without a corresponding C<=over>.
+Manual page indexers are often extremely picky about the format of this
+section, so don't put anything in it except this line. A single dash, and
+only a single dash, should separate the list of programs or functions from
+the description. Functions should not be qualified with C<()> or the like.
+The description should ideally fit on a single line, even if a man program
+replaces the dash with a few tabs.
-=item Unrecognized pod directive: %s
+=item SYNOPSIS
-(W) You specified a pod directive that isn't in the known list of
-C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>.
+A short usage summary for programs and functions. This section is mandatory
+for section 3 pages.
+=item DESCRIPTION
-=back
+Extended description and discussion of the program or functions, or the body
+of the documentation for man pages that document something else. If
+particularly long, it's a good idea to break this up into subsections
+C<=head2> directives like:
-=head1 NOTES
+ =head2 Normal Usage
-If you would like to print out a lot of man page continuously, you
-probably want to set the C and D registers to set contiguous page
-numbering and even/odd paging, at least on some versions of man(7).
-Settting the F register will get you some additional experimental
-indexing:
+ =head2 Advanced Features
- troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ...
+ =head2 Writing Configuration Files
-The indexing merely outputs messages via C<.tm> for each
-major page, section, subsection, item, and any C<XE<lt>E<gt>>
-directives.
+or whatever is appropriate for your documentation.
+=item OPTIONS
-=head1 RESTRICTIONS
+Detailed description of each of the command-line options taken by the
+program. This should be separate from the description for the use of things
+like L<Pod::Usage|Pod::Usage>. This is normally presented as a list, with
+each option as a separate C<=item>. The specific option string should be
+enclosed in BE<lt>E<gt>. Any values that the option takes should be
+enclosed in IE<lt>E<gt>. For example, the section for the option
+B<--section>=I<manext> would be introduced with:
-None at this time.
+ =item B<--section>=I<manext>
-=head1 BUGS
+Synonymous options (like both the short and long forms) are separated by a
+comma and a space on the same C<=item> line, or optionally listed as their
+own item with a reference to the canonical name. For example, since
+B<--section> can also be written as B<-s>, the above would be:
-The =over and =back directives don't really work right. They
-take absolute positions instead of offsets, don't nest well, and
-making people count is suboptimal in any event.
+ =item B<-s> I<manext>, B<--section>=I<manext>
-=head1 AUTHORS
+(Writing the short option first is arguably easier to read, since the long
+option is long enough to draw the eye to it anyway and the short option can
+otherwise get lost in visual noise.)
-Original prototype by Larry Wall, but so massively hacked over by
-Tom Christiansen such that Larry probably doesn't recognize it anymore.
+=item RETURN VALUE
-=cut
+What the program or function returns, if successful. This section can be
+omitted for programs whose precise exit codes aren't important, provided
+they return 0 on success as is standard. It should always be present for
+functions.
-$/ = "";
-$cutting = 1;
-@Indices = ();
-
-# We try first to get the version number from a local binary, in case we're
-# running an installed version of Perl to produce documentation from an
-# uninstalled newer version's pod files.
-if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') {
- my $perl = (-x './perl' && -f './perl' ) ?
- './perl' :
- ((-x '../perl' && -f '../perl') ?
- '../perl' :
- '');
- ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl;
-}
-# No luck; we'll just go with the running Perl's version
-($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version;
-$DEF_RELEASE = "perl $version";
-$DEF_RELEASE .= ", patch $patch" if $patch;
-
-
-sub makedate {
- my $secs = shift;
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs);
- my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon];
- $year += 1900;
- return "$mday/$mname/$year";
-}
+=item ERRORS
-use Getopt::Long;
-
-$DEF_SECTION = 1;
-$DEF_CENTER = "User Contributed Perl Documentation";
-$STD_CENTER = "Perl Programmers Reference Guide";
-$DEF_FIXED = 'CW';
-$DEF_LAX = 0;
-
-sub usage {
- warn "$0: @_\n" if @_;
- die <<EOF;
-usage: $0 [options] podpage
-Options are:
- --section=manext (default "$DEF_SECTION")
- --release=relpatch (default "$DEF_RELEASE")
- --center=string (default "$DEF_CENTER")
- --date=string (default "$DEF_DATE")
- --fixed=font (default "$DEF_FIXED")
- --official (default NOT)
- --lax (default NOT)
-EOF
-}
+Exceptions, error return codes, exit stati, and errno settings. Typically
+used for function documentation; program documentation uses DIAGNOSTICS
+instead. The general rule of thumb is that errors printed to STDOUT or
+STDERR and intended for the end user are documented in DIAGNOSTICS while
+errors passed internal to the calling program and intended for other
+programmers are documented in ERRORS. When documenting a function that sets
+errno, a full list of the possible errno values should be given here.
-$uok = GetOptions( qw(
- section=s
- release=s
- center=s
- date=s
- fixed=s
- official
- lax
- help));
+=item DIAGNOSTICS
-$DEF_DATE = makedate((stat($ARGV[0]))[9] || time());
+All possible messages the program can print out--and what they mean. You
+may wish to follow the same documentation style as the Perl documentation;
+see perldiag(1) for more details (and look at the POD source as well).
-usage("Usage error!") unless $uok;
-usage() if $opt_help;
-usage("Need one and only one podpage argument") unless @ARGV == 1;
+If applicable, please include details on what the user should do to correct
+the error; documenting an error as indicating "the input buffer is too
+small" without telling the user how to increase the size of the input buffer
+(or at least telling them that it isn't possible) aren't very useful.
-$section = $opt_section || ($ARGV[0] =~ /\.pm$/
- ? $DEF_PM_SECTION : $DEF_SECTION);
-$RP = $opt_release || $DEF_RELEASE;
-$center = $opt_center || ($opt_official ? $STD_CENTER : $DEF_CENTER);
-$lax = $opt_lax || $DEF_LAX;
+=item EXAMPLES
-$CFont = $opt_fixed || $DEF_FIXED;
+Give some example uses of the program or function. Don't skimp; users often
+find this the most useful part of the documentation. The examples are
+generally given as verbatim paragraphs.
-if (length($CFont) == 2) {
- $CFont_embed = "\\f($CFont";
-}
-elsif (length($CFont) == 1) {
- $CFont_embed = "\\f$CFont";
-}
-else {
- die "roff font should be 1 or 2 chars, not `$CFont_embed'";
-}
+Don't just present an example without explaining what it does. Adding a
+short paragraph saying what the example will do can increase the value of
+the example immensely.
-$date = $opt_date || $DEF_DATE;
+=item ENVIRONMENT
-for (qw{NAME DESCRIPTION}) {
-# for (qw{NAME DESCRIPTION AUTHOR}) {
- $wanna_see{$_}++;
-}
-$wanna_see{SYNOPSIS}++ if $section =~ /^3/;
+Environment variables that the program cares about, normally presented as a
+list using C<=over>, C<=item>, and C<=back>. For example:
+ =over 6
-$name = @ARGV ? $ARGV[0] : "<STDIN>";
-$Filename = $name;
-if ($section =~ /^1/) {
- require File::Basename;
- $name = uc File::Basename::basename($name);
-}
-$name =~ s/\.(pod|p[lm])$//i;
-
-# Lose everything up to the first of
-# */lib/*perl* standard or site_perl module
-# */*perl*/lib from -D prefix=/opt/perl
-# */*perl*/ random module hierarchy
-# which works.
-$name =~ s-//+-/-g;
-if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i
- or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i
- or $name =~ s-^.*?/[^/]*perl[^/]*/--i) {
- # Lose ^site(_perl)?/.
- $name =~ s-^site(_perl)?/--;
- # Lose ^arch/. (XXX should we use Config? Just for archname?)
- $name =~ s~^(.*-$^O|$^O-.*)/~~o;
- # Lose ^version/.
- $name =~ s-^\d+\.\d+/--;
-}
+ =item HOME
-# Translate Getopt/Long to Getopt::Long, etc.
-$name =~ s(/)(::)g;
-
-if ($name ne 'something') {
- FCHECK: {
- open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!";
- while (<F>) {
- next unless /^=\b/;
- if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes
- $_ = <F>;
- unless (/\s*-+\s+/) {
- $oops++;
- warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n"
- } else {
- my @n = split /\s+-+\s+/;
- if (@n != 2) {
- $oops++;
- warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n"
- }
- else {
- %namedesc = @n;
- }
- }
- last FCHECK;
- }
- next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME
- next if /^=pod\b/; # It is OK to have =pod before NAME
- die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax;
- }
- die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax;
- }
- close F;
-}
+ Used to determine the user's home directory. F<.foorc> in this
+ directory is read for configuration details, if it exists.
-print <<"END";
-.rn '' }`
-''' \$RCSfile\$\$Revision\$\$Date\$
-'''
-''' \$Log\$
-'''
-.de Sh
-.br
-.if t .Sp
-.ne 5
-.PP
-\\fB\\\\\$1\\fR
-.PP
-..
-.de Sp
-.if t .sp .5v
-.if n .sp
-..
-.de Ip
-.br
-.ie \\\\n(.\$>=3 .ne \\\\\$3
-.el .ne 3
-.IP "\\\\\$1" \\\\\$2
-..
-.de Vb
-.ft $CFont
-.nf
-.ne \\\\\$1
-..
-.de Ve
-.ft R
-
-.fi
-..
-'''
-'''
-''' Set up \\*(-- to give an unbreakable dash;
-''' string Tr holds user defined translation string.
-''' Bell System Logo is used as a dummy character.
-'''
-.tr \\(*W-|\\(bv\\*(Tr
-.ie n \\{\\
-.ds -- \\(*W-
-.ds PI pi
-.if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch
-.if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch
-.ds L" ""
-.ds R" ""
-''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of
-''' \\*(L" and \\*(R", except that they are used on ".xx" lines,
-''' such as .IP and .SH, which do another additional levels of
-''' double-quote interpretation
-.ds M" """
-.ds S" """
-.ds N" """""
-.ds T" """""
-.ds L' '
-.ds R' '
-.ds M' '
-.ds S' '
-.ds N' '
-.ds T' '
-'br\\}
-.el\\{\\
-.ds -- \\(em\\|
-.tr \\*(Tr
-.ds L" ``
-.ds R" ''
-.ds M" ``
-.ds S" ''
-.ds N" ``
-.ds T" ''
-.ds L' `
-.ds R' '
-.ds M' `
-.ds S' '
-.ds N' `
-.ds T' '
-.ds PI \\(*p
-'br\\}
-END
-
-print <<'END';
-.\" If the F register is turned on, we'll generate
-.\" index entries out stderr for the following things:
-.\" TH Title
-.\" SH Header
-.\" Sh Subsection
-.\" Ip Item
-.\" X<> Xref (embedded
-.\" Of course, you have to process the output yourself
-.\" in some meaninful fashion.
-.if \nF \{
-.de IX
-.tm Index:\\$1\t\\n%\t"\\$2"
-..
-.nr % 0
-.rr F
-.\}
-END
-
-print <<"END";
-.TH $name $section "$date" "$RP" "$center"
-.UC
-END
-
-push(@Indices, qq{.IX Title "$name $section"});
-
-while (($name, $desc) = each %namedesc) {
- for ($name, $desc) { s/^\s+//; s/\s+$//; }
- push(@Indices, qq(.IX Name "$name - $desc"\n));
-}
+ =back
-print <<'END';
-.if n .hy 0
-.if n .na
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.de CQ \" put $1 in typewriter font
-END
-print ".ft $CFont\n";
-print <<'END';
-'if n "\c
-'if t \\&\\$1\c
-'if n \\&\\$1\c
-'if n \&"
-\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
-'.ft R
-..
-.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
-. \" AM - accent mark definitions
-.bd B 3
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds ? ?
-. ds ! !
-. ds /
-. ds q
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
-. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
-.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
-.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
-.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-.ds oe o\h'-(\w'o'u*4/10)'e
-.ds Oe O\h'-(\w'O'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds v \h'-1'\o'\(aa\(ga'
-. ds _ \h'-1'^
-. ds . \h'-1'.
-. ds 3 3
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-. ds oe oe
-. ds Oe OE
-.\}
-.rm #[ #] #H #V #F C
-END
-
-$indent = 0;
-
-$begun = "";
-
-# Unrolling [^-=A-Z>]|[A-Z](?!<)|[-=](?![A-Z]<)[\x00-\xFF] gives: // MRE pp 165.
-my $nonest = q{(?x) # Turn on /x mode.
- (?: # Group
- [^-=A-Z>]* # Anything that isn't a dash, equal sign or
- # closing hook isn't special. Eat as much as
- # we can.
- (?: # Group.
- (?: # Group.
- [-=] # We want to recognize -> and =>.
- (?![A-Z]<) # So, as long as it isn't followed by markup
- [\x00-\xFF] # anything may follow - and =
- |
- [A-Z] # Capitals are fine too,
- (?!<) # But not if they start markup.
- ) # End of special sequences.
- [^-=A-Z>]* # Followed by zero or more non-special chars.
- )* # And we can repeat this as often as we can.
- )}; # That's all folks.
-
-while (<>) {
- if ($cutting) {
- next unless /^=/;
- $cutting = 0;
- }
- if ($begun) {
- if (/^=end\s+$begun/) {
- $begun = "";
- }
- elsif ($begun =~ /^(roff|man)$/) {
- print STDOUT $_;
- }
- next;
- }
- chomp;
-
- # Translate verbatim paragraph
-
- if (/^\s/) {
- @lines = split(/\n/);
- for (@lines) {
- 1 while s
- {^( [^\t]* ) \t ( \t* ) }
- { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex;
- s/\\/\\e/g;
- s/\A/\\&/s;
- }
- $lines = @lines;
- makespace() unless $verbatim++;
- print ".Vb $lines\n";
- print join("\n", @lines), "\n";
- print ".Ve\n";
- $needspace = 0;
- next;
- }
-
- $verbatim = 0;
-
- if (/^=for\s+(\S+)\s*/s) {
- if ($1 eq "man" or $1 eq "roff") {
- print STDOUT $',"\n\n";
- } else {
- # ignore unknown for
- }
- next;
- }
- elsif (/^=begin\s+(\S+)\s*/s) {
- $begun = $1;
- if ($1 eq "man" or $1 eq "roff") {
- print STDOUT $'."\n\n";
- }
- next;
- }
-
- # check for things that'll hosed our noremap scheme; affects $_
- init_noremap();
-
- if (!/^=item/) {
-
- # trofficate backslashes; must do it before what happens below
- s/\\/noremap('\\e')/ge;
-
- # protect leading periods and quotes against *roff
- # mistaking them for directives
- s/^(?:[A-Z]<)?[.']/\\&$&/gm;
-
- # first hide the escapes in case we need to
- # intuit something and get it wrong due to fmting
-
- 1 while s/([A-Z]<$nonest>)/noremap($1)/ge;
-
- # func() is a reference to a perl function
- s{
- \b
- (
- [:\w]+ \(\)
- )
- } {I<$1>}gx;
-
- # func(n) is a reference to a perl function or a man page
- s{
- ([:\w]+)
- (
- \( [^\051]+ \)
- )
- } {I<$1>\\|$2}gx;
-
- # convert simple variable references
- s/(\s+)([\$\@%&*][\w:]+)(?!\()/${1}C<$2>/g;
-
- if (m{ (
- [\-\w]+
- \(
- [^\051]*?
- [\@\$,]
- [^\051]*?
- \)
- )
- }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/)
- {
- warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n";
- $oops++;
- }
-
- while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) {
- warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n";
- $oops++;
- }
-
- # put it back so we get the <> processed again;
- clear_noremap(0); # 0 means leave the E's
-
- } else {
- # trofficate backslashes
- s/\\/noremap('\\e')/ge;
-
- }
-
- # need to hide E<> first; they're processed in clear_noremap
- s/(E<[^<>]+>)/noremap($1)/ge;
-
-
- $maxnest = 10;
- while ($maxnest-- && /[A-Z]</) {
-
- # can't do C font here
- s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg;
-
- # files and filelike refs in italics
- s/F<($nonest)>/I<$1>/g;
-
- # no break -- usually we want C<> for this
- s/S<($nonest)>/nobreak($1)/eg;
-
- # LREF: a la HREF L<show this text|man/section>
- s:L<([^|>]+)\|[^>]+>:$1:g;
-
- # LREF: a manpage(3f)
- s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g;
-
- # LREF: an =item on another manpage
- s{
- L<
- ([^/]+)
- /
- (
- [:\w]+
- (\(\))?
- )
- >
- } {the C<$2> entry in the I<$1> manpage}gx;
-
- # LREF: an =item on this manpage
- s{
- ((?:
- L<
- /
- (
- [:\w]+
- (\(\))?
- )
- >
- (,?\s+(and\s+)?)?
- )+)
- } { internal_lrefs($1) }gex;
-
- # LREF: a =head2 (head1?), maybe on a manpage, maybe right here
- # the "func" can disambiguate
- s{
- L<
- (?:
- ([a-zA-Z]\S+?) /
- )?
- "?(.*?)"?
- >
- }{
- do {
- $1 # if no $1, assume it means on this page.
- ? "the section on I<$2> in the I<$1> manpage"
- : "the section on I<$2>"
- }
- }gesx; # s in case it goes over multiple lines, so . matches \n
-
- s/Z<>/\\&/g;
-
- # comes last because not subject to reprocessing
- s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg;
- }
-
- if (s/^=//) {
- $needspace = 0; # Assume this.
-
- s/\n/ /g;
-
- ($Cmd, $_) = split(' ', $_, 2);
-
- $dotlevel = 1;
- if ($Cmd eq 'head1') {
- $dotlevel = 1;
- }
- elsif ($Cmd eq 'head2') {
- $dotlevel = 1;
- }
- elsif ($Cmd eq 'item') {
- $dotlevel = 2;
- }
-
- if (defined $_) {
- &escapes($dotlevel);
- s/"/""/g;
- }
-
- clear_noremap(1);
-
- if ($Cmd eq 'cut') {
- $cutting = 1;
- }
- elsif ($Cmd eq 'head1') {
- s/\s+$//;
- delete $wanna_see{$_} if exists $wanna_see{$_};
- print qq{.SH "$_"\n};
- push(@Indices, qq{.IX Header "$_"\n});
- }
- elsif ($Cmd eq 'head2') {
- print qq{.Sh "$_"\n};
- push(@Indices, qq{.IX Subsection "$_"\n});
- }
- elsif ($Cmd eq 'over') {
- push(@indent,$indent);
- $indent += ($_ + 0) || 5;
- }
- elsif ($Cmd eq 'back') {
- $indent = pop(@indent);
- warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent;
- $needspace = 1;
- }
- elsif ($Cmd eq 'item') {
- s/^\*( |$)/\\(bu$1/g;
- # if you know how to get ":s please do
- s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g;
- s/\\\*\(L"([^"]+?)""/'$1'/g;
- s/[^"]""([^"]+?)""[^"]/'$1'/g;
- # here do something about the $" in perlvar?
- print STDOUT qq{.Ip "$_" $indent\n};
- push(@Indices, qq{.IX Item "$_"\n});
- }
- elsif ($Cmd eq 'pod') {
- # this is just a comment
- }
- else {
- warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n";
- }
- }
- else {
- if ($needspace) {
- &makespace;
- }
- &escapes(0);
- clear_noremap(1);
- print $_, "\n";
- $needspace = 1;
- }
-}
+Since environment variables are normally in all uppercase, no additional
+special formatting is generally needed; they're glaring enough as it is.
-print <<"END";
+=item FILES
-.rn }` ''
-END
+All files used by the program or function, normally presented as a list, and
+what it uses them for. File names should be enclosed in FE<lt>E<gt>. It's
+particularly important to document files that will be potentially modified.
-if (%wanna_see && !$lax) {
- @missing = keys %wanna_see;
- warn "$0: $Filename is missing required section"
- . (@missing > 1 && "s")
- . ": @missing\n";
- $oops++;
-}
+=item CAVEATS
-foreach (@Indices) { print "$_\n"; }
+Things to take special care with, sometimes called WARNINGS.
-exit;
-#exit ($oops != 0);
+=item BUGS
-#########################################################################
+Things that are broken or just don't work quite right.
-sub nobreak {
- my $string = shift;
- $string =~ s/ /\\ /g;
- $string;
-}
+=item RESTRICTIONS
-sub escapes {
- my $indot = shift;
-
- s/X<(.*?)>/mkindex($1)/ge;
-
- # translate the minus in foo-bar into foo\-bar for roff
- s/([^0-9a-z-])-([^-])/$1\\-$2/g;
-
- # make -- into the string version \*(-- (defined above)
- s/\b--\b/\\*(--/g;
- s/"--([^"])/"\\*(--$1/g; # should be a better way
- s/([^"])--"/$1\\*(--"/g;
-
- # fix up quotes; this is somewhat tricky
- my $dotmacroL = 'L';
- my $dotmacroR = 'R';
- if ( $indot == 1 ) {
- $dotmacroL = 'M';
- $dotmacroR = 'S';
- }
- elsif ( $indot >= 2 ) {
- $dotmacroL = 'N';
- $dotmacroR = 'T';
- }
- if (!/""/) {
- s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge;
- s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge;
- }
-
- #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g;
- #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g;
-
-
- # make sure that func() keeps a bit a space tween the parens
- ### s/\b\(\)/\\|()/g;
- ### s/\b\(\)/(\\|)/g;
-
- # make C++ into \*C+, which is a squinched version (defined above)
- s/\bC\+\+/\\*(C+/g;
-
- # make double underbars have a little tiny space between them
- s/__/_\\|_/g;
-
- # PI goes to \*(PI (defined above)
- s/\bPI\b/noremap('\\*(PI')/ge;
-
- # make all caps a teeny bit smaller, but don't muck with embedded code literals
- my $hidCFont = font('C');
- if ($Cmd !~ /^head1/) { # SH already makes smaller
- # /g isn't enough; 1 while or we'll be off
-
-# 1 while s{
-# (?!$hidCFont)(..|^.|^)
-# \b
-# (
-# [A-Z][\/A-Z+:\-\d_$.]+
-# )
-# (s?)
-# \b
-# } {$1\\s-1$2\\s0}gmox;
-
- 1 while s{
- (?!$hidCFont)(..|^.|^)
- (
- \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b
- )
- } {
- $1 . noremap( '\\s-1' . $2 . '\\s0' )
- }egmox;
-
- }
-}
+Bugs you don't plan to fix. :-)
-# make troff just be normal, but make small nroff get quoted
-# decided to just put the quotes in the text; sigh;
-sub ccvt {
- local($_,$prev) = @_;
- noremap(qq{.CQ "$_" \n\\&});
-}
+=item NOTES
-sub makespace {
- if ($indent) {
- print ".Sp\n";
- }
- else {
- print ".PP\n";
- }
-}
+Miscellaneous commentary.
-sub mkindex {
- my ($entry) = @_;
- my @entries = split m:\s*/\s*:, $entry;
- push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries;
- return '';
-}
+=item SEE ALSO
-sub font {
- local($font) = shift;
- return '\\f' . noremap($font);
-}
+Other man pages to check out, like man(1), man(7), makewhatis(8), or
+catman(8). Normally a simple list of man pages separated by commas, or a
+paragraph giving the name of a reference work. Man page references, if they
+use the standard C<name(section)> form, don't have to be enclosed in
+LE<lt>E<gt>, but other things in this section probably should be when
+appropriate. You may need to use the C<LE<lt>...|...E<gt>> syntax to keep
+B<pod2man> and B<pod2text> from being too verbose; see perlpod(1).
-sub noremap {
- local($thing_to_hide) = shift;
- $thing_to_hide =~ tr/\000-\177/\200-\377/;
- return $thing_to_hide;
-}
+If the package has a web site, include a URL here.
-sub init_noremap {
- # escape high bit characters in input stream
- s/([\200-\377])/"E<".ord($1).">"/ge;
-}
+=item AUTHOR
-sub clear_noremap {
- my $ready_to_print = $_[0];
-
- tr/\200-\377/\000-\177/;
-
- # trofficate backslashes
- # s/(?!\\e)(?:..|^.|^)\\/\\e/g;
-
- # now for the E<>s, which have been hidden until now
- # otherwise the interative \w<> processing would have
- # been hosed by the E<gt>
- s {
- E<
- (
- ( \d + )
- | ( [A-Za-z]+ )
- )
- >
- } {
- do {
- defined $2
- ? chr($2)
- :
- exists $HTML_Escapes{$3}
- ? do { $HTML_Escapes{$3} }
- : do {
- warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n";
- "E<$1>";
- }
- }
- }egx if $ready_to_print;
-}
+Who wrote it (use AUTHORS for multiple people). Including your current
+e-mail address (or some e-mail address to which bug reports should be sent)
+so that users have a way of contacting you is a good idea. Remember that
+program documentation tends to roam the wild for far longer than you expect
+and pick an e-mail address that's likely to last if possible.
-sub internal_lrefs {
- local($_) = shift;
- local $trailing_and = s/and\s+$// ? "and " : "";
-
- s{L</([^>]+)>}{$1}g;
- my(@items) = split( /(?:,?\s+(?:and\s+)?)/ );
- my $retstr = "the ";
- my $i;
- for ($i = 0; $i <= $#items; $i++) {
- $retstr .= "C<$items[$i]>";
- $retstr .= ", " if @items > 2 && $i != $#items;
- $retstr .= " and " if $i+2 == @items;
- }
-
- $retstr .= " entr" . ( @items > 1 ? "ies" : "y" )
- . " elsewhere in this document";
- # terminal space to avoid words running together (pattern used
- # strips terminal spaces)
- $retstr .= " " if length $trailing_and;
- $retstr .= $trailing_and;
-
- return $retstr;
+=item HISTORY
-}
+Programs derived from other sources sometimes have this, or you might keep a
+modification log here.
-BEGIN {
-%HTML_Escapes = (
- 'amp' => '&', # ampersand
- 'lt' => '<', # left chevron, less-than
- 'gt' => '>', # right chevron, greater-than
- 'quot' => '"', # double quote
-
- "Aacute" => "A\\*'", # capital A, acute accent
- "aacute" => "a\\*'", # small a, acute accent
- "Acirc" => "A\\*^", # capital A, circumflex accent
- "acirc" => "a\\*^", # small a, circumflex accent
- "AElig" => '\*(AE', # capital AE diphthong (ligature)
- "aelig" => '\*(ae', # small ae diphthong (ligature)
- "Agrave" => "A\\*`", # capital A, grave accent
- "agrave" => "A\\*`", # small a, grave accent
- "Aring" => 'A\\*o', # capital A, ring
- "aring" => 'a\\*o', # small a, ring
- "Atilde" => 'A\\*~', # capital A, tilde
- "atilde" => 'a\\*~', # small a, tilde
- "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark
- "auml" => 'a\\*:', # small a, dieresis or umlaut mark
- "Ccedil" => 'C\\*,', # capital C, cedilla
- "ccedil" => 'c\\*,', # small c, cedilla
- "Eacute" => "E\\*'", # capital E, acute accent
- "eacute" => "e\\*'", # small e, acute accent
- "Ecirc" => "E\\*^", # capital E, circumflex accent
- "ecirc" => "e\\*^", # small e, circumflex accent
- "Egrave" => "E\\*`", # capital E, grave accent
- "egrave" => "e\\*`", # small e, grave accent
- "ETH" => '\\*(D-', # capital Eth, Icelandic
- "eth" => '\\*(d-', # small eth, Icelandic
- "Euml" => "E\\*:", # capital E, dieresis or umlaut mark
- "euml" => "e\\*:", # small e, dieresis or umlaut mark
- "Iacute" => "I\\*'", # capital I, acute accent
- "iacute" => "i\\*'", # small i, acute accent
- "Icirc" => "I\\*^", # capital I, circumflex accent
- "icirc" => "i\\*^", # small i, circumflex accent
- "Igrave" => "I\\*`", # capital I, grave accent
- "igrave" => "i\\*`", # small i, grave accent
- "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark
- "iuml" => "i\\*:", # small i, dieresis or umlaut mark
- "Ntilde" => 'N\*~', # capital N, tilde
- "ntilde" => 'n\*~', # small n, tilde
- "Oacute" => "O\\*'", # capital O, acute accent
- "oacute" => "o\\*'", # small o, acute accent
- "Ocirc" => "O\\*^", # capital O, circumflex accent
- "ocirc" => "o\\*^", # small o, circumflex accent
- "Ograve" => "O\\*`", # capital O, grave accent
- "ograve" => "o\\*`", # small o, grave accent
- "Oslash" => "O\\*/", # capital O, slash
- "oslash" => "o\\*/", # small o, slash
- "Otilde" => "O\\*~", # capital O, tilde
- "otilde" => "o\\*~", # small o, tilde
- "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark
- "ouml" => "o\\*:", # small o, dieresis or umlaut mark
- "szlig" => '\*8', # small sharp s, German (sz ligature)
- "THORN" => '\\*(Th', # capital THORN, Icelandic
- "thorn" => '\\*(th',, # small thorn, Icelandic
- "Uacute" => "U\\*'", # capital U, acute accent
- "uacute" => "u\\*'", # small u, acute accent
- "Ucirc" => "U\\*^", # capital U, circumflex accent
- "ucirc" => "u\\*^", # small u, circumflex accent
- "Ugrave" => "U\\*`", # capital U, grave accent
- "ugrave" => "u\\*`", # small u, grave accent
- "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark
- "uuml" => "u\\*:", # small u, dieresis or umlaut mark
- "Yacute" => "Y\\*'", # capital Y, acute accent
- "yacute" => "y\\*'", # small y, acute accent
- "yuml" => "y\\*:", # small y, dieresis or umlaut mark
-);
-}
+=back
+
+In addition, some systems use CONFORMING TO to note conformance to relevant
+standards and MT-LEVEL to note safeness for use in threaded programs or
+signal handlers. These headings are primarily useful when documenting parts
+of a C library. Documentation of object-oriented libraries or modules may
+use CONSTRUCTORS and METHODS sections for detailed documentation of the
+parts of the library and save the DESCRIPTION section for an overview; other
+large modules may use FUNCTIONS for similar reasons. Some people use
+OVERVIEW to summarize the description if it's quite long. Sometimes there's
+an additional COPYRIGHT section at the bottom, for licensing terms.
+AVAILABILITY is sometimes added, giving the canonical download site for the
+software or a URL for updates.
+
+Section ordering varies, although NAME should I<always> be the first section
+(you'll break some man page systems otherwise), and NAME, SYNOPSIS,
+DESCRIPTION, and OPTIONS generally always occur first and in that order if
+present. In general, SEE ALSO, AUTHOR, and similar material should be left
+for last. Some systems also move WARNINGS and NOTES to last. The order
+given above should be reasonable for most purposes.
+
+Finally, as a general note, try not to use an excessive amount of markup.
+As documented here and in L<Pod::Man>, you can safely leave Perl variables,
+function names, man page references, and the like unadorned by markup and
+the POD translators will figure it out for you. This makes it much easier
+to later edit the documentation. Note that many existing translators
+(including this one currently) will do the wrong thing with e-mail addresses
+or URLs when wrapped in LE<lt>E<gt>, so don't do that.
+
+For additional information that may be more accurate for your specific
+system, see either man(5) or man(7) depending on your system manual section
+numbering conventions.
+
+=head1 SEE ALSO
+
+L<Pod::Man|Pod::Man>, L<Pod::Parser|Pod::Parser>, man(1), nroff(1),
+troff(1), man(7)
+
+The man page documenting the an macro set may be man(5) instead of man(7) on
+your system.
+
+=head1 AUTHOR
+
+Russ Allbery E<lt>rra@stanford.eduE<gt>, based I<very> heavily on the
+original B<pod2man> by Larry Wall and Tom Christiansen. Large portions of
+this documentation, particularly the sections on the anatomy of a proper man
+page, are taken from the B<pod2man> documentation by Tom.
+=cut
!NO!SUBS!
close OUT or die "Can't close $file: $!";
diff --git a/pod/pod2text.PL b/pod/pod2text.PL
index 92b26feceb..79cf8b219b 100644
--- a/pod/pod2text.PL
+++ b/pod/pod2text.PL
@@ -28,23 +28,22 @@ print "Extracting $file (with variable substitutions)\n";
print OUT <<"!GROK!THIS!";
$Config{startperl}
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
- if \$running_under_some_shell;
+ if \$running_under_some_shell;
!GROK!THIS!
# In the following, perl variables are not expanded during extraction.
print OUT <<'!NO!SUBS!';
-$ID = q$Id: pod2text,v 0.1 1999/06/13 02:42:18 eagle Exp $;
-
# pod2text -- Convert POD data to formatted ASCII text.
-# Copyright 1999 by Russ Allbery <rra@stanford.edu>
+#
+# Copyright 1999 by Russ Allbery <rra@stanford.edu>
#
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
-# The driver script for Pod::Text, Pod::Text::Termcap, and
-# Pod::Text::Color, invoked by perldoc -t among other things.
+# The driver script for Pod::Text, Pod::Text::Termcap, and Pod::Text::Color,
+# invoked by perldoc -t among other things.
require 5.004;
@@ -65,8 +64,8 @@ for (my $i = 0; $i < @ARGV; $i++) {
}
}
-# Parse our options. Use the same names as Pod::Text for simplicity,
-# and default to sentence boundaries turned off for compatibility.
+# Parse our options. Use the same names as Pod::Text for simplicity, and
+# default to sentence boundaries turned off for compatibility.
my %options;
$options{termcap} = -t STDOUT;
$options{sentence} = 0;
@@ -79,6 +78,8 @@ pod2usage (1) if $options{help};
my $formatter = 'Pod::Text';
if ($options{color}) {
$formatter = 'Pod::Text::Color';
+ eval { require Term::ANSIColor };
+ if ($@) { die "-c (--color) requires Term::ANSIColor be installed\n" }
require Pod::Text::Color;
} elsif ($options{termcap}) {
$formatter = 'Pod::Text::Termcap';
@@ -104,16 +105,19 @@ pod2text B<-h>
=head1 DESCRIPTION
-B<pod2text> is a front-end for Pod::Text and its subclasses. It uses
-them to generate formatted ASCII text from POD source. It can optionally
-use either termcap sequences or ANSI color escape sequences to format the
-text.
+B<pod2text> is a front-end for Pod::Text and its subclasses. It uses them
+to generate formatted ASCII text from POD source. It can optionally use
+either termcap sequences or ANSI color escape sequences to format the text.
I<input> is the file to read for POD source (the POD can be embedded in
code). If I<input> isn't given, it defaults to STDIN. I<output>, if given,
is the file to which to write the formatted output. If I<output> isn't
given, the formatted output is written to STDOUT.
+B<pod2text> defaults to trying to use Pod::Text::Termcap if STDOUT is a tty.
+To explicitly say not to attempt termcap escape sequences, use
+B<--notermcap>.
+
=head1 OPTIONS
=over 4
@@ -133,17 +137,20 @@ requires that Term::ANSIColor be installed on your system.
Set the number of spaces to indent regular text, and the default indentation
for C<=over> blocks. Defaults to 4 spaces if this option isn't given.
+=item B<-h>, B<--help>
+
+Print out usage information and exit.
+
=item B<-l>, B<--loose>
Print a blank line after a C<=head1> heading. Normally, no blank line is
-printed after C<=head1>, although one is still printed after C<=head2>.
-This is the default because it's the expected formatting for manual pages;
-if you're formatting arbitrary text documents, using this option is
-recommended.
+printed after C<=head1>, although one is still printed after C<=head2>,
+because this is the expected formatting for manual pages; if you're
+formatting arbitrary text documents, using this option is recommended.
=item B<-s>, B<--sentence>
-Assume each sentence ends in two spaces and try to preserve that spacing.
+Assume each sentence ends with two spaces and try to preserve that spacing.
Without this option, all consecutive whitespace in non-verbatim paragraphs
is compressed into a single space.
@@ -154,8 +161,8 @@ sequences for the terminal from termcap, and use that information in
formatting the output. Output will be wrapped at two columns less than the
width of your terminal device. Using this option requires that your system
have a termcap file somewhere where Term::Cap can find it. With this
-option, the output of B<pod2text> will contain terminal control sequences for
-your current terminal type.
+option, the output of B<pod2text> will contain terminal control sequences
+for your current terminal type.
=item B<-w>, B<--width=>I<width>, B<->I<width>
@@ -165,6 +172,28 @@ your terminal device.
=back
+=head1 DIAGNOSTICS
+
+If B<pod2text> fails with errors, see L<Pod::Text> and L<Pod::Parser> for
+information about what those errors might mean. Internally, it can also
+produce the following diagnostics:
+
+=over 4
+
+=item -c (--color) requires Term::ANSIColor be installed
+
+(F) B<-c> or B<--color> were given, but Term::ANSIColor could not be
+loaded.
+
+=item Unknown option: %s
+
+(F) An unknown command line option was given.
+
+=back
+
+In addition, other L<Getopt::Long|Getopt::Long> error messages may result
+from invalid command-line options.
+
=head1 ENVIRONMENT
=over 4
@@ -183,11 +212,6 @@ current terminal device.
=back
-=head1 DIAGNOSTICS
-
-If B<pod2text> fails with POD errors, see L<Pod::Text> and
-L<Pod::Parser> for information about what those errors might mean.
-
=head1 SEE ALSO
L<Pod::Text|Pod::Text>, L<Pod::Text::Color|Pod::Text::Color>,
diff --git a/pod/pod2usage.PL b/pod/pod2usage.PL
index adf49bd69d..24e93fa350 100644
--- a/pod/pod2usage.PL
+++ b/pod/pod2usage.PL
@@ -39,10 +39,7 @@ print OUT <<'!NO!SUBS!';
#############################################################################
# pod2usage -- command to print usage messages from embedded pod docs
#
-# Derived from Tom Christiansen's pod2text script.
-# (with extensive modifications)
-#
-# Copyright (c) 1996 Bradford Appleton. All rights reserved.
+# Copyright (c) 1996-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
diff --git a/pod/podchecker.PL b/pod/podchecker.PL
index 0d31763879..89c2899248 100644
--- a/pod/podchecker.PL
+++ b/pod/podchecker.PL
@@ -38,10 +38,7 @@ print OUT <<'!NO!SUBS!';
#############################################################################
# podchecker -- command to invoke the podchecker function in Pod::Checker
#
-# Derived from Tom Christiansen's pod2text script.
-# (with extensive modifications)
-#
-# Copyright (c) 1998 Bradford Appleton. All rights reserved.
+# Copyright (c) 1998-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
diff --git a/pod/podselect.PL b/pod/podselect.PL
index a76f6a045f..3fa411846b 100644
--- a/pod/podselect.PL
+++ b/pod/podselect.PL
@@ -39,10 +39,7 @@ print OUT <<'!NO!SUBS!';
#############################################################################
# podselect -- command to invoke the podselect function in Pod::Select
#
-# Derived from Tom Christiansen's pod2text script.
-# (with extensive modifications)
-#
-# Copyright (c) 1996 Bradford Appleton. All rights reserved.
+# Copyright (c) 1996-1999 by Bradford Appleton. All rights reserved.
# This file is part of "PodParser". PodParser is free software;
# you can redistribute it and/or modify it under the same terms
# as Perl itself.
diff --git a/t/lib/thread.t b/t/lib/thread.t
index 3bca8ba726..6c25407853 100755
--- a/t/lib/thread.t
+++ b/t/lib/thread.t
@@ -55,9 +55,7 @@ sleep 6;
print "ok 12\n";
$t->join;
-sub islocked
-{
- use attrs 'locked';
+sub islocked : locked {
my $val = shift;
my $ret;
print $val;
@@ -74,8 +72,7 @@ $t->join->join;
{
package Loch::Ness;
sub new { bless [], shift }
- sub monster {
- use attrs qw(locked method);
+ sub monster : locked, method {
my($s, $m) = @_;
print "ok $m\n";
}
diff --git a/t/op/avhv.t b/t/op/avhv.t
index 6837127d52..92afa37d37 100755
--- a/t/op/avhv.t
+++ b/t/op/avhv.t
@@ -17,7 +17,7 @@ sub STORESIZE { $#{$_[0]} = $_[1]+1 }
package main;
-print "1..12\n";
+print "1..15\n";
$sch = {
'abc' => 1,
@@ -108,3 +108,13 @@ f($a->{key});
print "not " unless $a->[1] eq 'b';
print "ok 12\n";
+# check if exists() is behaving properly
+$avhv = [{foo=>1,bar=>2,pants=>3}];
+print "not " if exists $avhv->{bar};
+print "ok 13\n";
+
+$avhv->{pants} = undef;
+print "not " unless exists $avhv->{pants};
+print "ok 14\n";
+print "not " if exists $avhv->{bar};
+print "ok 15\n";
diff --git a/t/pod/emptycmd.t b/t/pod/emptycmd.t
index 59e395ea04..d348a9d278 100755
--- a/t/pod/emptycmd.t
+++ b/t/pod/emptycmd.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/for.t b/t/pod/for.t
index 44af44f17d..b8a6ec5c73 100755
--- a/t/pod/for.t
+++ b/t/pod/for.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/for.xr b/t/pod/for.xr
index 25794ab0fe..5f6b8b2ce8 100644
--- a/t/pod/for.xr
+++ b/t/pod/for.xr
@@ -1,19 +1,21 @@
This is a test
- pod2text should see this and this and this
+ pod2text should see this
+ and this
+ and this
and everything should see this!
- Similarly, this line ...
+Similarly, this line ...
- and this one ...
+and this one ...
- as well this one,
+as well this one,
- should all be in pod2text output
+should all be in pod2text output
- Tweedley-deedley-dee, Im as happy as can be! Tweedley-deedley-
- dum, cuz youre my honey sugar plum!
+ Tweedley-deedley-dee, Im as happy as can be! Tweedley-deedley-dum, cuz
+ youre my honey sugar plum!
The rest of this should show up in everything.
diff --git a/t/pod/headings.t b/t/pod/headings.t
index 78608d0fd9..fc7b4b265b 100755
--- a/t/pod/headings.t
+++ b/t/pod/headings.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/headings.xr b/t/pod/headings.xr
index e1277b7e37..fb37a2b0cf 100644
--- a/t/pod/headings.xr
+++ b/t/pod/headings.xr
@@ -5,25 +5,22 @@ SYNOPSIS
rdb2pg [*param*=*value* ...]
PARAMETERS
- rdb2pg uses an IRAF-compatible parameter interface. A template
- parameter file is in /proj/axaf/simul/lib/uparm/rdb2pg.par.
+ rdb2pg uses an IRAF-compatible parameter interface. A template parameter
+ file is in /proj/axaf/simul/lib/uparm/rdb2pg.par.
input *file*
- The RDB file to insert into the database. If the given name
- is the string `stdin', it reads from the UNIX standard input
- stream.
-
+ The RDB file to insert into the database. If the given name is the
+ string `stdin', it reads from the UNIX standard input stream.
DESCRIPTION
- rdb2pg will enter the data from an RDB database into a
- PostgreSQL database table, optionally creating the database and
- the table if they do not exist. It automatically determines the
- PostgreSQL data type from the column definition in the RDB file,
- but may be overriden via a series of definition files or
- directly via one of its parameters.
+ rdb2pg will enter the data from an RDB database into a PostgreSQL
+ database table, optionally creating the database and the table if they
+ do not exist. It automatically determines the PostgreSQL data type from
+ the column definition in the RDB file, but may be overriden via a series
+ of definition files or directly via one of its parameters.
- The target database and table are specified by the `db' and
- `table' parameters. If they do not exist, and the `createdb'
- parameter is set, they will be created. Table field definitions
- are determined in the following order:
+ The target database and table are specified by the `db' and `table'
+ parameters. If they do not exist, and the `createdb' parameter is set,
+ they will be created. Table field definitions are determined in the
+ following order:
diff --git a/t/pod/include.t b/t/pod/include.t
index 4e73b78356..6d0b7e34e5 100755
--- a/t/pod/include.t
+++ b/t/pod/include.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/include.xr b/t/pod/include.xr
index 1bac06adb1..624ee44447 100644
--- a/t/pod/include.xr
+++ b/t/pod/include.xr
@@ -1,20 +1,19 @@
- This file tries to demonstrate a simple =include directive for
- pods. It is used as follows:
+ This file tries to demonstrate a simple =include directive for pods. It
+ is used as follows:
=include filename
- where "filename" is expected to be an absolute pathname, or else
- reside be relative to the directory in which the current
- processed podfile resides, or be relative to the current
- directory.
+ where "filename" is expected to be an absolute pathname, or else reside
+ be relative to the directory in which the current processed podfile
+ resides, or be relative to the current directory.
Lets try it out with the file "included.t" shall we.
***THIS TEXT IS IMMEDIATELY BEFORE THE INCLUDE***
###### begin =include included.t #####
- This is the text of the included file named "included.t". It
- should appear in the final pod document from pod2xxx
+ This is the text of the included file named "included.t". It should
+ appear in the final pod document from pod2xxx
###### end =include included.t #####
***THIS TEXT IS IMMEDIATELY AFTER THE INCLUDE***
diff --git a/t/pod/included.t b/t/pod/included.t
index 4f171c454b..0e31a090fc 100755
--- a/t/pod/included.t
+++ b/t/pod/included.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/included.xr b/t/pod/included.xr
index f0bc03bf09..54142fa0d3 100644
--- a/t/pod/included.xr
+++ b/t/pod/included.xr
@@ -1,3 +1,3 @@
- This is the text of the included file named "included.t". It
- should appear in the final pod document from pod2xxx
+ This is the text of the included file named "included.t". It should
+ appear in the final pod document from pod2xxx
diff --git a/t/pod/lref.t b/t/pod/lref.t
index 02e2c9e307..e367d6dd66 100755
--- a/t/pod/lref.t
+++ b/t/pod/lref.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/lref.xr b/t/pod/lref.xr
index d8455e3874..297053b1ac 100644
--- a/t/pod/lref.xr
+++ b/t/pod/lref.xr
@@ -1,22 +1,22 @@
Try out *LOTS* of different ways of specifying references:
- Reference the the "section" entry in the manpage manpage
+ Reference the the section entry in the manpage manpage
- Reference the the "section" entry in the manpage manpage
+ Reference the the section entry in the manpage manpage
- Reference the the "section" entry in the manpage manpage
+ Reference the the section entry in the manpage manpage
- Reference the the "section" entry in the manpage manpage
+ Reference the the section entry in the manpage manpage
Reference the the section on "manpage/section"
- Reference the the "section" entry in the "manpage" manpage
+ Reference the the section entry in the "manpage" manpage
Reference the the section on "section" in the manpage manpage
- Reference the the "section" entry in the manpage manpage
+ Reference the the section entry in the manpage manpage
- Reference the the "section" entry in the manpage manpage
+ Reference the the section entry in the manpage manpage
Now try it using the new "|" stuff ...
diff --git a/t/pod/multiline_items.t b/t/pod/multiline_items.t
new file mode 100755
index 0000000000..37e8d53069
--- /dev/null
+++ b/t/pod/multiline_items.t
@@ -0,0 +1,31 @@
+#!./perl
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
+ require "testp2pt.pl";
+ import TestPodIncPlainText;
+}
+
+my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash
+my $passed = testpodplaintext \%options, $0;
+exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE};
+
+
+__END__
+
+
+=head1 Test multiline item lists
+
+This is a test to ensure that multiline =item paragraphs
+get indented appropriately.
+
+=over 4
+
+=item This
+is
+a
+test.
+
+=back
+
+=cut
diff --git a/t/pod/multiline_items.xr b/t/pod/multiline_items.xr
new file mode 100644
index 0000000000..dddf05fe34
--- /dev/null
+++ b/t/pod/multiline_items.xr
@@ -0,0 +1,5 @@
+Test multiline item lists
+ This is a test to ensure that multiline =item paragraphs get indented
+ appropriately.
+
+ This is a test.
diff --git a/t/pod/nested_items.t b/t/pod/nested_items.t
index c8e9b22427..9c098018d1 100755
--- a/t/pod/nested_items.t
+++ b/t/pod/nested_items.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/nested_items.xr b/t/pod/nested_items.xr
index 7d72bbe890..dd1adac127 100644
--- a/t/pod/nested_items.xr
+++ b/t/pod/nested_items.xr
@@ -1,6 +1,6 @@
Test nested item lists
- This is a test to ensure the nested =item paragraphs get
- indented appropriately.
+ This is a test to ensure the nested =item paragraphs get indented
+ appropriately.
1 First section.
diff --git a/t/pod/nested_seqs.t b/t/pod/nested_seqs.t
index 8559f1f25f..6a5405bf47 100755
--- a/t/pod/nested_seqs.t
+++ b/t/pod/nested_seqs.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/nested_seqs.xr b/t/pod/nested_seqs.xr
index 5a008c17e9..f981061f94 100644
--- a/t/pod/nested_seqs.xr
+++ b/t/pod/nested_seqs.xr
@@ -1,3 +1,3 @@
- The statement: `This is dog kind's *finest* hour!' is a parody
- of a quotation from Winston Churchill.
+ The statement: `This is dog kind's *finest* hour!' is a parody of a
+ quotation from Winston Churchill.
diff --git a/t/pod/oneline_cmds.t b/t/pod/oneline_cmds.t
index 28bd1d09e5..3081ef4dc3 100755
--- a/t/pod/oneline_cmds.t
+++ b/t/pod/oneline_cmds.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/oneline_cmds.xr b/t/pod/oneline_cmds.xr
index e1277b7e37..fb37a2b0cf 100644
--- a/t/pod/oneline_cmds.xr
+++ b/t/pod/oneline_cmds.xr
@@ -5,25 +5,22 @@ SYNOPSIS
rdb2pg [*param*=*value* ...]
PARAMETERS
- rdb2pg uses an IRAF-compatible parameter interface. A template
- parameter file is in /proj/axaf/simul/lib/uparm/rdb2pg.par.
+ rdb2pg uses an IRAF-compatible parameter interface. A template parameter
+ file is in /proj/axaf/simul/lib/uparm/rdb2pg.par.
input *file*
- The RDB file to insert into the database. If the given name
- is the string `stdin', it reads from the UNIX standard input
- stream.
-
+ The RDB file to insert into the database. If the given name is the
+ string `stdin', it reads from the UNIX standard input stream.
DESCRIPTION
- rdb2pg will enter the data from an RDB database into a
- PostgreSQL database table, optionally creating the database and
- the table if they do not exist. It automatically determines the
- PostgreSQL data type from the column definition in the RDB file,
- but may be overriden via a series of definition files or
- directly via one of its parameters.
+ rdb2pg will enter the data from an RDB database into a PostgreSQL
+ database table, optionally creating the database and the table if they
+ do not exist. It automatically determines the PostgreSQL data type from
+ the column definition in the RDB file, but may be overriden via a series
+ of definition files or directly via one of its parameters.
- The target database and table are specified by the `db' and
- `table' parameters. If they do not exist, and the `createdb'
- parameter is set, they will be created. Table field definitions
- are determined in the following order:
+ The target database and table are specified by the `db' and `table'
+ parameters. If they do not exist, and the `createdb' parameter is set,
+ they will be created. Table field definitions are determined in the
+ following order:
diff --git a/t/pod/pod2usage.t b/t/pod/pod2usage.t
new file mode 100755
index 0000000000..bceeeefce8
--- /dev/null
+++ b/t/pod/pod2usage.t
@@ -0,0 +1,18 @@
+#!./perl
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
+ require "testp2pt.pl";
+ import TestPodIncPlainText;
+}
+
+my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash
+my $passed = testpodplaintext \%options, $0;
+exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE};
+
+
+__END__
+
+=include pod2usage.PL
+
+
diff --git a/t/pod/pod2usage.xr b/t/pod/pod2usage.xr
new file mode 100644
index 0000000000..7315d4025a
--- /dev/null
+++ b/t/pod/pod2usage.xr
@@ -0,0 +1,55 @@
+###### begin =include pod2usage.PL #####
+NAME
+ pod2usage - print usage messages from embedded pod docs in files
+
+SYNOPSIS
+ pod2usage [-help] [-man] [-exit *exitval*] [-output *outfile*]
+ [-verbose *level*] [-pathlist *dirlist*] *file*
+
+OPTIONS AND ARGUMENTS
+ -help Print a brief help message and exit.
+
+ -man Print this command's manual page and exit.
+
+ -exit *exitval*
+ The exit status value to return.
+
+ -output *outfile*
+ The output file to print to. If the special names "-" or ">&1"
+ or ">&STDOUT" are used then standard output is used. If ">&2" or
+ ">&STDERR" is used then standard error is used.
+
+ -verbose *level*
+ The desired level of verbosity to use:
+
+ 1 : print SYNOPSIS only
+ 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
+ 3 : print the entire manpage (similar to running pod2text)
+
+ -pathlist *dirlist*
+ Specifies one or more directories to search for the input file
+ if it was not supplied with an absolute path. Each directory
+ path in the given list should be separated by a ':' on Unix (';'
+ on MSWin32 and DOS).
+
+ *file* The pathname of a file containing pod documentation to be output
+ in usage mesage format (defaults to standard input).
+
+DESCRIPTION
+ pod2usage will read the given input file looking for pod documentation
+ and will print the corresponding usage message. If no input file is
+ specifed than standard input is read.
+
+ pod2usage invokes the pod2usage() function in the Pod::Usage module.
+ Please see the pod2usage() entry in the Pod::Usage manpage.
+
+SEE ALSO
+ the Pod::Usage manpage, the pod2text(1) manpage
+
+AUTHOR
+ Brad Appleton <bradapp@enteract.com>
+
+ Based on code for pod2text(1) written by Tom Christiansen
+ <tchrist@mox.perl.com>
+
+###### end =include pod2usage.PL #####
diff --git a/t/pod/poderrs.t b/t/pod/poderrs.t
index 591bd2a86d..9cbbeeeb91 100755
--- a/t/pod/poderrs.t
+++ b/t/pod/poderrs.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testpchk.pl";
import TestPodChecker;
}
diff --git a/t/pod/poderrs.xr b/t/pod/poderrs.xr
index a7bc42d956..82d402d8b2 100644
--- a/t/pod/poderrs.xr
+++ b/t/pod/poderrs.xr
@@ -1,11 +1,11 @@
-*** ERROR: Unknown command "unknown1" at line 21 of file t/poderrs.t
-*** ERROR: Unknown interior-sequence "N" at line 21 of file t/poderrs.t
-*** ERROR: Unknown interior-sequence "D" at line 22 of file t/poderrs.t
-*** ERROR: Unknown interior-sequence "Q" at line 25 of file t/poderrs.t
-*** ERROR: Unknown interior-sequence "A" at line 26 of file t/poderrs.t
-*** ERROR: Unknown interior-sequence "V" at line 27 of file t/poderrs.t
-*** ERROR: Unknown interior-sequence "Y" at line 27 of file t/poderrs.t
-** Unterminated B<...> at t/poderrs.t line 31
-** Unterminated I<...> at t/poderrs.t line 30
-** Unterminated C<...> at t/poderrs.t line 33
-t/poderrs.t has 10 pod syntax errors.
+*** ERROR: Unknown command "unknown1" at line 21 in file pod/poderrs.t
+*** ERROR: Unknown interior-sequence "N" at line 21 in file pod/poderrs.t
+*** ERROR: Unknown interior-sequence "D" at line 22 in file pod/poderrs.t
+*** ERROR: Unknown interior-sequence "Q" at line 25 in file pod/poderrs.t
+*** ERROR: Unknown interior-sequence "A" at line 26 in file pod/poderrs.t
+*** ERROR: Unknown interior-sequence "V" at line 27 in file pod/poderrs.t
+*** ERROR: Unknown interior-sequence "Y" at line 27 in file pod/poderrs.t
+** Unterminated B<...> at pod/poderrs.t line 31
+** Unterminated I<...> at pod/poderrs.t line 30
+** Unterminated C<...> at pod/poderrs.t line 33
+pod/poderrs.t has 10 pod syntax errors.
diff --git a/t/pod/podselect.t b/t/pod/podselect.t
new file mode 100755
index 0000000000..30eb30c9b0
--- /dev/null
+++ b/t/pod/podselect.t
@@ -0,0 +1,18 @@
+#!./perl
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
+ require "testp2pt.pl";
+ import TestPodIncPlainText;
+}
+
+my %options = map { $_ => 1 } @ARGV; ## convert cmdline to options-hash
+my $passed = testpodplaintext \%options, $0;
+exit( ($passed == 1) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE};
+
+
+__END__
+
+=include podselect.PL
+
+
diff --git a/t/pod/podselect.xr b/t/pod/podselect.xr
new file mode 100644
index 0000000000..7d1188d84c
--- /dev/null
+++ b/t/pod/podselect.xr
@@ -0,0 +1,42 @@
+###### begin =include podselect.PL #####
+NAME
+ podselect - print selected sections of pod documentation on standard
+ output
+
+SYNOPSIS
+ podselect [-help] [-man] [-section *section-spec*] [*file* ...]
+
+OPTIONS AND ARGUMENTS
+ -help Print a brief help message and exit.
+
+ -man Print the manual page and exit.
+
+ -section *section-spec*
+ Specify a section to include in the output. See the section on
+ "SECTION SPECIFICATIONS" in the Pod::Parser manpage for the
+ format to use for *section-spec*. This option may be given
+ multiple times on the command line.
+
+ *file* The pathname of a file from which to select sections of pod
+ documentation (defaults to standard input).
+
+DESCRIPTION
+ podselect will read the given input files looking for pod documentation
+ and will print out (in raw pod format) all sections that match one ore
+ more of the given section specifications. If no section specifications
+ are given than all pod sections encountered are output.
+
+ podselect invokes the podselect() function exported by Pod::Select
+ Please see the podselect() entry in the Pod::Select manpage for more
+ details.
+
+SEE ALSO
+ the Pod::Parser manpage and the Pod::Select manpage
+
+AUTHOR
+ Brad Appleton <bradapp@enteract.com>
+
+ Based on code for Pod::Text::pod2text(1) written by Tom Christiansen
+ <tchrist@mox.perl.com>
+
+###### end =include podselect.PL #####
diff --git a/t/pod/special_seqs.t b/t/pod/special_seqs.t
index 1b31387dd3..572fb8c061 100755
--- a/t/pod/special_seqs.t
+++ b/t/pod/special_seqs.t
@@ -1,7 +1,7 @@
+#!./perl
BEGIN {
- use File::Basename;
- my $THISDIR = dirname $0;
- unshift @INC, $THISDIR;
+ chdir 't' if -d 't';
+ unshift @INC, './pod', '../lib';
require "testp2pt.pl";
import TestPodIncPlainText;
}
diff --git a/t/pod/special_seqs.xr b/t/pod/special_seqs.xr
index 6795de0490..fc06593d9d 100644
--- a/t/pod/special_seqs.xr
+++ b/t/pod/special_seqs.xr
@@ -1,13 +1,11 @@
- This is a test to see if I can do not only `$self' and
- `method()', but also `$self->method()' and `$self->{FIELDNAME}'
- and `{FOO=>BAR}' without resorting to escape sequences.
+ This is a test to see if I can do not only `$self' and `method()', but
+ also `$self->method()' and `$self->{FIELDNAME}' and `{FOO=>BAR}' without
+ resorting to escape sequences.
- Now for the grand finale of `$self->method()->{FIELDNAME} =
- {FOO=>BAR}'.
+ Now for the grand finale of `$self->method()->{FIELDNAME} = {FOO=>BAR}'.
- Of course I should still be able to do all this *with* escape
- sequences too: `$self->method()' and `$self->{FIELDNAME}' and
- `{FOO=>BAR}'.
+ Of course I should still be able to do all this *with* escape sequences
+ too: `$self->method()' and `$self->{FIELDNAME}' and `{FOO=>BAR}'.
Dont forget `$self->method()->{FIELDNAME} = {FOO=>BAR}'.
diff --git a/t/pod/testp2pt.pl b/t/pod/testp2pt.pl
index 9df5b9f2ed..234a5271c4 100644
--- a/t/pod/testp2pt.pl
+++ b/t/pod/testp2pt.pl
@@ -13,8 +13,6 @@ BEGIN {
push @INC, map { File::Spec->catfile($_, 'lib') } ($PARENTDIR, $THISDIR);
}
-use Pod::PlainText;
-use vars qw(@ISA @EXPORT $MYPKG);
#use strict;
#use diagnostics;
use Carp;
@@ -22,13 +20,23 @@ use Exporter;
#use File::Compare;
#use Cwd qw(abs_path);
-@ISA = qw(Pod::PlainText);
-@EXPORT = qw(&testpodplaintext);
+use vars qw($MYPKG @EXPORT @ISA);
$MYPKG = eval { (caller)[0] };
+@EXPORT = qw(&testpodplaintext);
+BEGIN {
+ if ( $] >= 5.005_58 ) {
+ require Pod::Text;
+ @ISA = qw( Pod::Text );
+ }
+ else {
+ require Pod::PlainText;
+ @ISA = qw( Pod::PlainText );
+ }
+}
## Hardcode settings for TERMCAP and COLUMNS so we can try to get
## reproducible results between environments
-@ENV{qw(TERMCAP COLUMNS)} = ('co=72:do=^J', 72);
+@ENV{qw(TERMCAP COLUMNS)} = ('co=76:do=^J', 76);
sub catfile(@) { File::Spec->catfile(@_); }
@@ -37,7 +45,7 @@ $INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'xtra');
$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'pod');
$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 't');
my @PODINCDIRS = ( catfile($INSTDIR, 'lib', 'Pod'),
- catfile($INSTDIR, 'scripts'),
+ catfile($INSTDIR, 'pod'),
catfile($INSTDIR, 't', 'pod'),
catfile($INSTDIR, 't', 'pod', 'xtra')
);
@@ -111,7 +119,7 @@ sub testpodinc2plaintext( @ ) {
return $msg;
}
- print "+ Running testpodinc2plaintext for '$testname'...\n";
+ print "# Running testpodinc2plaintext for '$testname'...\n";
## Compare the output against the expected result
podinc2plaintext($infile, $outfile);
if ( testcmp($outfile, $cmpfile) ) {
@@ -145,12 +153,12 @@ sub testpodplaintext( @ ) {
if ($opts{'-xrgen'}) {
if ($opts{'-force'} or ! -e $cmpfile) {
## Create the comparison file
- print "+ Creating expected result for \"$testname\"" .
+ print "# Creating expected result for \"$testname\"" .
" pod2plaintext test ...\n";
podinc2plaintext($podfile, $cmpfile);
}
else {
- print "+ File $cmpfile already exists" .
+ print "# File $cmpfile already exists" .
" (use '-force' to regenerate it).\n";
}
next;
@@ -162,13 +170,13 @@ sub testpodplaintext( @ ) {
-Cmp => $cmpfile;
if ($failmsg) {
++$failed;
- print "+\tFAILED. ($failmsg)\n";
+ print "#\tFAILED. ($failmsg)\n";
print "not ok ", $failed+$passes, "\n";
}
else {
++$passes;
unlink($outfile);
- print "+\tPASSED.\n";
+ print "#\tPASSED.\n";
print "ok ", $failed+$passes, "\n";
}
}
diff --git a/t/pod/testpchk.pl b/t/pod/testpchk.pl
index cd3c13816d..07236e69e7 100644
--- a/t/pod/testpchk.pl
+++ b/t/pod/testpchk.pl
@@ -62,7 +62,7 @@ sub testpodcheck( @ ) {
return $msg;
}
- print "+ Running podchecker for '$testname'...\n";
+ print "# Running podchecker for '$testname'...\n";
## Compare the output against the expected result
podchecker($infile, $outfile);
if ( testcmp({'-cmplines' => \&msgcmp}, $outfile, $cmpfile) ) {
@@ -96,12 +96,12 @@ sub testpodchecker( @ ) {
if ($opts{'-xrgen'}) {
if ($opts{'-force'} or ! -e $cmpfile) {
## Create the comparison file
- print "+ Creating expected result for \"$testname\"" .
+ print "# Creating expected result for \"$testname\"" .
" podchecker test ...\n";
podchecker($podfile, $cmpfile);
}
else {
- print "+ File $cmpfile already exists" .
+ print "# File $cmpfile already exists" .
" (use '-force' to regenerate it).\n";
}
next;
@@ -113,13 +113,13 @@ sub testpodchecker( @ ) {
-Cmp => $cmpfile;
if ($failmsg) {
++$failed;
- print "+\tFAILED. ($failmsg)\n";
+ print "#\tFAILED. ($failmsg)\n";
print "not ok ", $failed+$passes, "\n";
}
else {
++$passes;
unlink($outfile);
- print "+\tPASSED.\n";
+ print "#\tPASSED.\n";
print "ok ", $failed+$passes, "\n";
}
}
diff --git a/t/pragma/sub_lval.t b/t/pragma/sub_lval.t
index c382ad52ae..e96c329d8e 100755
--- a/t/pragma/sub_lval.t
+++ b/t/pragma/sub_lval.t
@@ -5,8 +5,8 @@ BEGIN {
unshift @INC, '../lib';
}
-sub a {use attrs 'lvalue'; my $a = 34; bless \$a} # Return a temporary
-sub b {use attrs 'lvalue'; shift}
+sub a : lvalue { my $a = 34; bless \$a } # Return a temporary
+sub b : lvalue { shift }
my $out = a(b()); # Check that temporaries are allowed.
print "# `$out'\nnot " unless ref $out eq 'main'; # Not reached if error.
@@ -20,8 +20,8 @@ my $in;
# Check that we can return localized values from subroutines:
-sub in {use attrs 'lvalue'; $in = shift;}
-sub neg {use attrs 'lvalue'; #(num_str) return num_str
+sub in : lvalue { $in = shift; }
+sub neg : lvalue { #(num_str) return num_str
local $_ = shift;
s/^\+/-/;
$_;
@@ -32,11 +32,11 @@ in(neg("+2"));
print "# `$in'\nnot " unless $in eq '-2';
print "ok 3\n";
-sub get_lex {use attrs 'lvalue'; $in}
-sub get_st {use attrs 'lvalue'; $blah}
-sub id {use attrs 'lvalue'; shift}
-sub id1 {use attrs 'lvalue'; $_[0]}
-sub inc {use attrs 'lvalue'; ++$_[0]}
+sub get_lex : lvalue { $in }
+sub get_st : lvalue { $blah }
+sub id : lvalue { shift }
+sub id1 : lvalue { $_[0] }
+sub inc : lvalue { ++$_[0] }
$in = 5;
$blah = 3;
@@ -139,9 +139,9 @@ $#c = 3; # These slots are not fillable.
=for disabled constructs
-sub a3 {use attrs 'lvalue'; @a}
-sub b2 {use attrs 'lvalue'; @b}
-sub c4 {use attrs 'lvalue'; @c}
+sub a3 :lvalue {@a}
+sub b2 : lvalue {@b}
+sub c4: lvalue {@c}
$_ = '';
@@ -162,7 +162,7 @@ print "ok 22\n";
my $var;
-sub a::var {use attrs 'lvalue'; $var}
+sub a::var : lvalue { $var }
"a"->var = 45;
@@ -177,7 +177,7 @@ $o->var = 47;
print "# `$var' ne 47\nnot " unless $var eq 47;
print "ok 24\n";
-sub o {use attrs 'lvalue'; $o}
+sub o : lvalue { $o }
o->var = 49;
@@ -242,7 +242,7 @@ print "# '$_', '$x0', '$x1'.\nnot "
unless /Can\'t modify non-lvalue subroutine call/;
print "ok 30\n";
-sub lv0 {use attrs 'lvalue';} # Converted to lv10 in scalar context
+sub lv0 : lvalue { } # Converted to lv10 in scalar context
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -254,7 +254,7 @@ print "# '$_'.\nnot "
unless /Can\'t return a readonly value from lvalue subroutine/;
print "ok 31\n";
-sub lv10 {use attrs 'lvalue';}
+sub lv10 : lvalue {}
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -265,7 +265,7 @@ EOE
print "# '$_'.\nnot " if defined $_;
print "ok 32\n";
-sub lv1u {use attrs 'lvalue'; undef }
+sub lv1u :lvalue { undef }
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -288,7 +288,7 @@ print "# '$_'.\nnot "
print "ok 34\n";
$x = '1234567';
-sub lv1t {use attrs 'lvalue'; index $x, 2 }
+sub lv1t : lvalue { index $x, 2 }
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -312,7 +312,7 @@ print "ok 36\n";
$xxx = 'xxx';
sub xxx () { $xxx } # Not lvalue
-sub lv1tmp {use attrs 'lvalue'; xxx } # is it a TEMP?
+sub lv1tmp : lvalue { xxx } # is it a TEMP?
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -335,7 +335,7 @@ print "# '$_'.\nnot "
print "ok 38\n";
sub xxx () { 'xxx' } # Not lvalue
-sub lv1tmpr {use attrs 'lvalue'; xxx } # is it a TEMP?
+sub lv1tmpr : lvalue { xxx } # is it a TEMP?
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -359,7 +359,7 @@ print "ok 40\n";
=for disabled constructs
-sub lva {use attrs 'lvalue';@a}
+sub lva : lvalue {@a}
$_ = undef;
@a = ();
@@ -401,7 +401,7 @@ print "ok 43\n";
print "ok $_\n" for 41..43;
-sub lv1n {use attrs 'lvalue'; $newvar }
+sub lv1n : lvalue { $newvar }
$_ = undef;
eval <<'EOE' or $_ = $@;
@@ -412,7 +412,7 @@ EOE
print "# '$_', '$newvar'.\nnot " unless "'$newvar' $_" eq "'4' ";
print "ok 44\n";
-sub lv1nn {use attrs 'lvalue'; $nnewvar }
+sub lv1nn : lvalue { $nnewvar }
$_ = undef;
eval <<'EOE' or $_ = $@;
diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index a9b882688a..730a730e26 100644
--- a/utils/h2xs.PL
+++ b/utils/h2xs.PL
@@ -271,15 +271,15 @@ to rewrite this function as
int
foo(sv)
- SV *addr
- PREINIT:
- STRLEN len;
- char *s;
- CODE:
- s = SvPV(sv,len);
- RETVAL = foo(s, len);
- OUTPUT:
- RETVAL
+ SV *addr
+ PREINIT:
+ STRLEN len;
+ char *s;
+ CODE:
+ s = SvPV(sv,len);
+ RETVAL = foo(s, len);
+ OUTPUT:
+ RETVAL
or alternately
@@ -393,7 +393,8 @@ To install C::Scan, execute
perl -MCPAN -e "install C::Scan"
EOD
}
-} elsif ($opt_o or $opt_F) {
+}
+elsif ($opt_o or $opt_F) {
warn <<EOD;
Options -o and -F do not make sense without -x.
EOD
@@ -410,10 +411,11 @@ if( @path_h ){
# XXXX This is not equivalent to what the older version did:
# it was looking at $hadsys header-file per header-file...
my($hadsys) = grep s!^sys/!!i , @path_h;
- @paths = qw( Sys\$Library VAXC$Include );
+ @paths = qw( Sys$Library VAXC$Include );
push @paths, ($hadsys ? 'GNU_CC_Include[vms]' : 'GNU_CC_Include[000000]');
push @paths, qw( DECC$Library_Include DECC$System_Include );
- } else {
+ }
+ else {
@paths = (File::Spec->curdir(), $Config{usrinc},
(split ' ', $Config{locincpth}), '/usr/include');
}
@@ -507,7 +509,8 @@ else {
if ($opt_O) {
warn "Overwriting existing $ext$modpname!!!\n" if -e $modpname;
-} else {
+}
+else {
die "Won't overwrite existing $ext$modpname\n" if -e $modpname;
}
if( $nested ){
@@ -710,17 +713,18 @@ sub AUTOLOAD {
goto &AutoLoader::AUTOLOAD;
}
else {
- croak "Your vendor has not defined $module macro \$constname";
+ croak "Your vendor has not defined $module macro \$constname";
}
}
- { no strict 'refs';
- # Next line doesn't help with older Perls; in newers: no such warnings
- # local \$^W = 0; # Prototype mismatch: sub XXX vs ()
- if (\$] >= 5.00561) { # Fixed between 5.005_53 and 5.005_61
- *\$AUTOLOAD = sub () { \$val };
- } else {
- *\$AUTOLOAD = sub { \$val };
- }
+ {
+ no strict 'refs';
+ # Fixed between 5.005_53 and 5.005_61
+ if (\$] >= 5.00561) {
+ *\$AUTOLOAD = sub () { \$val };
+ }
+ else {
+ *\$AUTOLOAD = sub { \$val };
+ }
}
goto &\$AUTOLOAD;
}
@@ -808,7 +812,7 @@ EOD
}
my $pod = <<"END" unless $opt_P;
-## Below is the stub of documentation for your module. You better edit it!
+## Below is stub documentation for your module. You better edit it!
#
#=head1 NAME
#
@@ -821,7 +825,7 @@ my $pod = <<"END" unless $opt_P;
#
#=head1 DESCRIPTION
#
-#Stub documentation for $module was created by h2xs. It looks like the
+#Stub documentation for $module, created by h2xs. It looks like the
#author of the extension was negligent enough to leave the stub
#unedited.
#
@@ -1020,7 +1024,8 @@ EOP
print $fh <<EOP;
return constant_$pref$leader$letter(name, len, arg);
EOP
- } else {
+ }
+ else {
# Do it ourselves
my $protect
= protect_convert_to_double("$pref$leader$letter$leading{$letter}[0]");
@@ -1081,13 +1086,13 @@ $_()
CODE:
#ifdef $_
- RETVAL = $_;
+ RETVAL = $_;
#else
- croak("Your vendor has not defined the $module macro $_");
+ croak("Your vendor has not defined the $module macro $_");
#endif
OUTPUT:
- RETVAL
+ RETVAL
END
}
@@ -1098,15 +1103,15 @@ print XS <<"END" unless $opt_c;
double
constant(sv,arg)
-PREINIT:
+ PREINIT:
STRLEN len;
-INPUT:
+ INPUT:
SV * sv
char * s = SvPV(sv, len);
int arg
-CODE:
+ CODE:
RETVAL = constant(s,len,arg);
-OUTPUT:
+ OUTPUT:
RETVAL
END
@@ -1196,7 +1201,8 @@ sub normalize_type { # Second arg: do not strip const's before \*
= "(?:\\b(?:(?:__const__|const)$keep_deep_const|static|inline|__inline__)\\b\\s*)*";
if ($do_keep_deep_const) { # Keep different compiled /RExen/o separately!
$type =~ s/$ignore_mods//go;
- } else {
+ }
+ else {
$type =~ s/$ignore_mods//go;
}
$type =~ s/([^\s\w])/ \1 /g;
diff --git a/vms/vms.c b/vms/vms.c
index ab24000153..5d5f7f7cd3 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -95,10 +95,6 @@ static bool will_taint = FALSE; /* tainting active, but no PL_curinterp yet */
/* munching */
static int no_translate_barewords;
-/* True if we shouldn't treat barewords as logicals during directory */
-/* munching */
-static int no_translate_barewords;
-
/*{{{int vmstrnenv(const char *lnm, char *eqv, unsigned long int idx, struct dsc$descriptor_s **tabvec, unsigned long int flags) */
int
vmstrnenv(const char *lnm, char *eqv, unsigned long int idx,