File: ppodindex

package info (click to toggle)
libpod-pseudopod-perl 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 280 kB
  • sloc: perl: 1,428; makefile: 9
file content (48 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

######################################################################
#
# A sample PseudoPod to TXT converter script that uses
# Pod::PseudoPod::Index.
#
# usage:
#
# ./textindex filename1.pod filename2.pod
#
# Will produce one html file for each pod file passed in.
#
#   filename1.html
#   filename2.html
#
######################################################################

use strict;
use lib "../lib"; # delete this line
use Pod::PseudoPod::Index;

my $parser;

my $outfile = 'index.txt'; # in the current working directory

open TXTOUT, ">$outfile" or die "Can't write to $outfile: $!";

my $index = {};

foreach my $file (@ARGV) {
	$parser = Pod::PseudoPod::Index->new($index);
	$parser->no_errata_section(1); # don't put errors in doc output
	$parser->complain_stderr(1);   # output errors on STDERR instead

	if (-e $file) {
		$parser->parse_file($file);
	} else {
		die "Unable to open file\n";
	}
}

$parser->output_fh(*TXTOUT);
$parser->output_text;

close TXTOUT;

exit;