Debian Codegraph @

bin/podtoc

raw
1 #!/usr/bin/env perl
2 # podtoc -- show outline of pods
3
4 # ------ pragmas
5 use strict;
6 use warnings;
7
8 our $VERSION = '2.0.0';
9
10 # ------ define variables
11 my $inpod = undef;
12
13 $/ = '';
14
15 $inpod = 0;
16 while (<>) {
17 print "$ARGV\n" if $. == 1;
18 if ($inpod && /^=cut/) {
19 $inpod = 0;
20 next;
21 }
22
23 if (! $inpod && /^=(?!cut)\w+/) {
24 $inpod = 1;
25 }
26
27 if ($inpod) {
28 next unless /^=(?:head|item)/;
29 s/=head(\d)/' ' x ( $1 - 1 )/e;
30 s/=item/ * /;
31 s/\n+$/\n/;
32 print;
33 }
34
35
36 } continue {
37
38 if (eof) {
39 $inpod = 0;
40 close ARGV;
41 }
42
43 }
44
45 __END__
46
47 =head1 NAME
48
49 podtoc - show outline of pods
50
51 =head1 DESCRIPTION
52
53 This program shows the structure of one or more pod documents.
54
55 =head1 EXAMPLES
56
57 $ podtoc `pmpath CGI`
58 NAME
59 SYNOPSIS
60 ABSTRACT
61 DESCRIPTION
62 PROGRAMMING STYLE
63 CALLING CGI.PM ROUTINES
64 * 1. Use another name for the argument, if one is available. For
65 example, -value is an alias for -values.
66 * 2. Change the capitalization, e.g. -Values
67 (etc)
68
69 =head1 SEE ALSO
70
71 pod2man(1), perlpod(1).
72
73 =head1 AUTHORS and COPYRIGHTS
74
75 Copyright (C) 1999 Tom Christiansen.
76
77 Copyright (C) 2006-2014 Mark Leighton Fisher.
78
79 =head1 LICENSE
80
81 This is free software; you can redistribute it and/or modify it
82 under the terms of either:
83 (a) the GNU General Public License as published by the Free
84 Software Foundation; either version 1, or (at your option) any
85 later version, or
86 (b) the Perl "Artistic License".
87 (This is the Perl 5 licensing scheme.)
88
89 Please note this is a change from the
90 original pmtools-1.00 (still available on CPAN),
91 as pmtools-1.00 were licensed only under the
92 Perl "Artistic License".