Debian Codegraph @

bin/pomdump

raw
1 #!/usr/bin/perl -w
2
3 use strict;
4 use FindBin qw($Bin);
5 use lib "$Bin/../lib";
6 use Pod::POM;
7 use Getopt::Std;
8 use File::Basename;
9
10 my $program = basename($0);
11
12 my %opts;
13 getopts('h', \%opts);
14 die usage() if $opts{ h };
15
16 my $file = shift || die usage();
17
18 my $parser;
19 {
20 no warnings 'once';
21 $parser = Pod::POM->new( code => 1 )
22 || die "$Pod::POM::ERROR\n";
23 }
24
25 my $pom = $parser->parse_file($file)
26 || die $parser->error(), "\n";
27
28 print $pom->dump;
29
30
31 sub usage {
32 return <<EOF;
33 usage: $program file
34
35 Parses a Pod file and dumps the parse tree.
36 EOF
37 }
38
39 =head1 NAME
40
41 pomdump - dump the POM parse tree for a POD document
42
43 =head1 SYNOPSIS
44
45 pomdump MyFile.pm
46
47 =head1 DESCRIPTION
48
49 This script uses Pod::POM to parse a Pod document and then invokes the
50 dump method on the top level node, resulting in a visualization of the
51 structure of the POD document (the parse tree).
52
53 =head1 AUTHOR
54
55 Andrew Ford E<lt>[email protected]<gt>
56
57 =head1 VERSION
58
59 This is version 0.1 of pomdump.
60
61 =head1 COPYRIGHT
62
63 Copyright (C) 2009 Andrew Ford. All Rights Reserved.
64
65 This module is free software; you can redistribute it and/or
66 modify it under the same terms as Perl itself.
67
68 =head1 SEE ALSO
69
70 For further information please see L<Pod::POM>.