home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D2.iso / workshop / apache / files / ActivePerl-5.6.1.638-MSWin32-x86.msi / _8f60af82fc24b80657dccbb25fa34eb5 < prev    next >
Encoding:
Text File  |  2004-04-13  |  7.4 KB  |  232 lines

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!perl
  14. #line 15
  15.     eval 'exec C:\p4view\Apps\ActivePerl\MSI\data\ActivePerl\Perl\bin\perl.exe -S $0 ${1+"$@"}'
  16.         if $running_under_some_shell;
  17.  
  18. # pod2text -- Convert POD data to formatted ASCII text.
  19. #
  20. # Copyright 1999, 2000 by Russ Allbery <rra@stanford.edu>
  21. #
  22. # This program is free software; you can redistribute it and/or modify it
  23. # under the same terms as Perl itself.
  24. #
  25. # The driver script for Pod::Text, Pod::Text::Termcap, and Pod::Text::Color,
  26. # invoked by perldoc -t among other things.
  27.  
  28. require 5.004;
  29.  
  30. use Getopt::Long qw(GetOptions);
  31. use Pod::Text ();
  32. use Pod::Usage qw(pod2usage);
  33.  
  34. use strict;
  35.  
  36. # Take an initial pass through our options, looking for one of the form
  37. # -<number>.  We turn that into -w <number> for compatibility with the
  38. # original pod2text script.
  39. for (my $i = 0; $i < @ARGV; $i++) {
  40.     last if $ARGV[$i] =~ /^--$/;
  41.     if ($ARGV[$i] =~ /^-(\d+)$/) {
  42.         splice (@ARGV, $i++, 1, '-w', $1);
  43.     }
  44. }
  45.  
  46. # Insert -- into @ARGV before any single dash argument to hide it from
  47. # Getopt::Long; we want to interpret it as meaning stdin (which Pod::Parser
  48. # does correctly).
  49. my $stdin;
  50. @ARGV = map { $_ eq '-' && !$stdin++ ? ('--', $_) : $_ } @ARGV;
  51.  
  52. # Parse our options.  Use the same names as Pod::Text for simplicity, and
  53. # default to sentence boundaries turned off for compatibility.
  54. my %options;
  55. $options{sentence} = 0;
  56. Getopt::Long::config ('bundling');
  57. GetOptions (\%options, 'alt|a', 'color|c', 'help|h', 'indent|i=i',
  58.             'loose|l', 'overstrike|o', 'quotes|q=s', 'sentence|s',
  59.             'termcap|t', 'width|w=i') or exit 1;
  60. pod2usage (1) if $options{help};
  61.  
  62. # Figure out what formatter we're going to use.  -c overrides -t.
  63. my $formatter = 'Pod::Text';
  64. if ($options{color}) {
  65.     $formatter = 'Pod::Text::Color';
  66.     eval { require Term::ANSIColor };
  67.     if ($@) { die "-c (--color) requires Term::ANSIColor be installed\n" }
  68.     require Pod::Text::Color;
  69. } elsif ($options{termcap}) {
  70.     $formatter = 'Pod::Text::Termcap';
  71.     require Pod::Text::Termcap;
  72. } elsif ($options{overstrike}) {
  73.     $formatter = 'Pod::Text::Overstrike';
  74.     require Pod::Text::Overstrike;
  75. }
  76. delete @options{'color', 'termcap', 'overstrike'};
  77.  
  78. # Initialize and run the formatter.
  79. my $parser = $formatter->new (%options);
  80. $parser->parse_from_file (@ARGV);
  81.  
  82. __END__
  83.  
  84. =head1 NAME
  85.  
  86. pod2text - Convert POD data to formatted ASCII text
  87.  
  88. =head1 SYNOPSIS
  89.  
  90. pod2text [B<-aclost>] [B<-i> I<indent>] [B<-q> I<quotes>] [B<-w> I<width>]
  91. [I<input> [I<output>]]
  92.  
  93. pod2text B<-h>
  94.  
  95. =head1 DESCRIPTION
  96.  
  97. B<pod2text> is a front-end for Pod::Text and its subclasses.  It uses them
  98. to generate formatted ASCII text from POD source.  It can optionally use
  99. either termcap sequences or ANSI color escape sequences to format the text.
  100.  
  101. I<input> is the file to read for POD source (the POD can be embedded in
  102. code).  If I<input> isn't given, it defaults to STDIN.  I<output>, if given,
  103. is the file to which to write the formatted output.  If I<output> isn't
  104. given, the formatted output is written to STDOUT.
  105.  
  106. =head1 OPTIONS
  107.  
  108. =over 4
  109.  
  110. =item B<-a>, B<--alt>
  111.  
  112. Use an alternate output format that, among other things, uses a different
  113. heading style and marks C<=item> entries with a colon in the left margin.
  114.  
  115. =item B<-c>, B<--color>
  116.  
  117. Format the output with ANSI color escape sequences.  Using this option
  118. requires that Term::ANSIColor be installed on your system.
  119.  
  120. =item B<-i> I<indent>, B<--indent=>I<indent>
  121.  
  122. Set the number of spaces to indent regular text, and the default indentation
  123. for C<=over> blocks.  Defaults to 4 spaces if this option isn't given.
  124.  
  125. =item B<-h>, B<--help>
  126.  
  127. Print out usage information and exit.
  128.  
  129. =item B<-l>, B<--loose>
  130.  
  131. Print a blank line after a C<=head1> heading.  Normally, no blank line is
  132. printed after C<=head1>, although one is still printed after C<=head2>,
  133. because this is the expected formatting for manual pages; if you're
  134. formatting arbitrary text documents, using this option is recommended.
  135.  
  136. =item B<-o>, B<--overstrike>
  137.  
  138. Format the output with overstruck printing.  Bold text is rendered as
  139. character, backspace, character.  Italics and file names are rendered as
  140. underscore, backspace, character.  Many pagers, such as B<less>, know how
  141. to convert this to bold or underlined text.
  142.  
  143. =item B<-q> I<quotes>, B<--quotes>=I<quotes>
  144.  
  145. Sets the quote marks used to surround CE<lt>> text to I<quotes>.  If
  146. I<quotes> is a single character, it is used as both the left and right
  147. quote; if I<quotes> is two characters, the first character is used as the
  148. left quote and the second as the right quoted; and if I<quotes> is four
  149. characters, the first two are used as the left quote and the second two as
  150. the right quote.
  151.  
  152. I<quotes> may also be set to the special value C<none>, in which case no
  153. quote marks are added around CE<lt>> text.
  154.  
  155. =item B<-s>, B<--sentence>
  156.  
  157. Assume each sentence ends with two spaces and try to preserve that spacing.
  158. Without this option, all consecutive whitespace in non-verbatim paragraphs
  159. is compressed into a single space.
  160.  
  161. =item B<-t>, B<--termcap>
  162.  
  163. Try to determine the width of the screen and the bold and underline
  164. sequences for the terminal from termcap, and use that information in
  165. formatting the output.  Output will be wrapped at two columns less than the
  166. width of your terminal device.  Using this option requires that your system
  167. have a termcap file somewhere where Term::Cap can find it and requires that
  168. your system support termios.  With this option, the output of B<pod2text>
  169. will contain terminal control sequences for your current terminal type.
  170.  
  171. =item B<-w>, B<--width=>I<width>, B<->I<width>
  172.  
  173. The column at which to wrap text on the right-hand side.  Defaults to 76,
  174. unless B<-t> is given, in which case it's two columns less than the width of
  175. your terminal device.
  176.  
  177. =back
  178.  
  179. =head1 DIAGNOSTICS
  180.  
  181. If B<pod2text> fails with errors, see L<Pod::Text> and L<Pod::Parser> for
  182. information about what those errors might mean.  Internally, it can also
  183. produce the following diagnostics:
  184.  
  185. =over 4
  186.  
  187. =item -c (--color) requires Term::ANSIColor be installed
  188.  
  189. (F) B<-c> or B<--color> were given, but Term::ANSIColor could not be
  190. loaded.
  191.  
  192. =item Unknown option: %s
  193.  
  194. (F) An unknown command line option was given.
  195.  
  196. =back
  197.  
  198. In addition, other L<Getopt::Long|Getopt::Long> error messages may result
  199. from invalid command-line options.
  200.  
  201. =head1 ENVIRONMENT
  202.  
  203. =over 4
  204.  
  205. =item COLUMNS
  206.  
  207. If B<-t> is given, B<pod2text> will take the current width of your screen
  208. from this environment variable, if available.  It overrides terminal width
  209. information in TERMCAP.
  210.  
  211. =item TERMCAP
  212.  
  213. If B<-t> is given, B<pod2text> will use the contents of this environment
  214. variable if available to determine the correct formatting sequences for your
  215. current terminal device.
  216.  
  217. =back
  218.  
  219. =head1 SEE ALSO
  220.  
  221. L<Pod::Text|Pod::Text>, L<Pod::Text::Color|Pod::Text::Color>,
  222. L<Pod::Text::Termcap|Pod::Text::Termcap>, L<Pod::Parser|Pod::Parser>
  223.  
  224. =head1 AUTHOR
  225.  
  226. Russ Allbery E<lt>rra@stanford.eduE<gt>.
  227.  
  228. =cut
  229.  
  230. __END__
  231. :endofperl
  232.