Debian Codegraph @

bin/ppod2txt

raw
1 #!/usr/bin/perl
2
3 ######################################################################
4 #
5 # A sample PseudoPod to text converter script that uses
6 # Pod::PseudoPod::Text.
7 #
8 # usage:
9 #
10 # $ ppod2txt filename1.pod filename2.pod
11 #
12 # Will produce one text file for each pod file passed in.
13 #
14 # filename1.txt
15 # filename2.txt
16 #
17 ######################################################################
18
19 use strict;
20 use lib "lib";
21 use Pod::PseudoPod::Text;
22 use File::Basename;
23
24 foreach my $file (@ARGV) {
25 my $parser = Pod::PseudoPod::Text->new();
26
27 # Text output goes to the current working
28 # directory not the source directory.
29 my $outfile = fileparse( $file, qr{\..*} ) . '.txt';
30
31 open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!";
32 $parser->output_fh(*TXTOUT);
33
34 $parser->no_errata_section(1); # don't put errors in doc output
35 $parser->complain_stderr(1); # output errors on STDERR instead
36
37 if (-e $file) {
38 $parser->parse_file($file);
39 } else {
40 die "Unable to open file\n";
41 }
42 close TXTOUT;
43 }
44
45 exit;