/usr/local/bin/pod2usage

filter: Statementstmt 92.5% 25 / 27 Branchbran 50.0% 11 / 22 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 67.8% 40 / 59 CC 1 SCAR 0.0
CC
1
Cov
70%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/App/CmdDirs/Traverser/Base.pm ↑ Summary build/build.PL »
1 #!/usr/local/bin/perl
2 1 eval 'exec perl -S $0 "$@"'
3 if 0;
4  
5 #############################################################################
6 # pod2usage -- command to print usage messages from embedded pod docs
7 #
8 # Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
9 # Copyright (c) 2001-2016 by Marek Rouchal.
10 # This file is part of "Pod-Usage". Pod-Usage is free software;
11 # you can redistribute it and/or modify it under the same terms
12 # as Perl itself.
13 #############################################################################
14  
15 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 #use diagnostics;
17  
18 =head1 NAME
19  
20 pod2usage - print usage messages from embedded pod docs in files
21  
22 =head1 SYNOPSIS
23  
24 =over 12
25  
26 =item B<pod2usage>
27  
28 [B<-help>]
29 [B<-man>]
30 [B<-exit>S< >I<exitval>]
31 [B<-output>S< >I<outfile>]
32 [B<-verbose> I<level>]
33 [B<-pathlist> I<dirlist>]
34 [B<-formatter> I<module>]
35 [B<-utf8>]
36 I<file>
37  
38 =back
39  
40 =head1 OPTIONS AND ARGUMENTS
41  
42 =over 8
43  
44 =item B<-help>
45  
46 Prints a brief help message and exit.
47  
48 =item B<-man>
49  
50 Prints this command's manual page and exit.
51  
52 =item B<-exit> I<exitval>
53  
54 The exit status value to return.
55  
56 =item B<-output> I<outfile>
57  
58 The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
59 are used then standard output is used. If ">&2" or ">&STDERR" is used then
60 standard error is used.
61  
62 =item B<-verbose> I<level>
63  
64 The desired level of verbosity to use:
65  
66 1 : print SYNOPSIS only
67 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
68 3 : print the entire manpage (similar to running pod2text)
69  
70 =item B<-pathlist> I<dirlist>
71  
72 Specifies one or more directories to search for the input file if it
73 was not supplied with an absolute path. Each directory path in the given
74 list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
75  
76 =item B<-formatter> I<module>
77  
78 Which text formatter to use. Default is L<Pod::Text>. An alternative would
79 be e.g. L<Pod::Text::Termcap>.
80  
81 =item B<-utf8>
82  
83 This option assumes that the formatter (see above) understands the option
84 "utf8". It turns on generation of utf8 output.
85  
86 =item I<file>
87  
88 The pathname of a file containing pod documentation to be output in
89 usage message format. If omitted, standard input is read - but the
90 output is then formatted with L<Pod::Text> only - unless a specific
91 formatter has been specified with B<-formatter>.
92  
93 =back
94  
95 =head1 DESCRIPTION
96  
97 B<pod2usage> will read the given input file looking for pod
98 documentation and will print the corresponding usage message.
99 If no input file is specified then standard input is read.
100  
101 B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
102 module. Please see L<Pod::Usage/pod2usage()>.
103  
104 =head1 SEE ALSO
105  
106 L<Pod::Usage>, L<pod2text>, L<Pod::Text>, L<Pod::Text::Termcap>,
107 L<perldoc>
108  
109 =head1 AUTHOR
110  
111 Please report bugs using L<http://rt.cpan.org>.
112  
113 Brad Appleton E<lt>bradapp@enteract.comE<gt>
114  
115 Based on code for B<pod2text(1)> written by
116 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
117  
118 =cut
119  
120 1 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
121  
122 ## Define options
123 1 my %options = ();
124 1 my @opt_specs = (
125 'help',
126 'man',
127 'exit=i',
128 'output=s',
129 'pathlist=s',
130 'formatter=s',
131 'verbose=i',
132 'utf8!'
133 );
134  
135 ## Parse options
136 1 ▶GetOptions(\%options, @opt_specs) || pod2usage(2);
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions(\%options, @opt_specs) or pod2usage(2) 1 0 1
137 1 ▶$Pod::Usage::Formatter = $options{formatter} if $options{formatter};
Branch: 1 branch
BranchTrueFalseTotal
if $options{"formatter"} 0 1 1
138 1 require Pod::Usage;
139 1 Pod::Usage->import();
140 1 ▶pod2usage(1) if ($options{help});
Branch: 1 branch
BranchTrueFalseTotal
if $options{"help"} 0 1 1
141 1 ▶pod2usage(VERBOSE => 2) if ($options{man});
Branch: 1 branch
BranchTrueFalseTotal
if $options{"man"} 0 1 1
142  
143 ## Dont default to STDIN if connected to a terminal
144 1 ▶pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
Branch: 1 branch
BranchTrueFalseTotal
if @ARGV == 0 and -t STDIN 0 1 1
Condition33%1/3
@ARGV == 0 and -t STDIN
!ll&&!rl&&r
100
MC/DC0%0/2
@ARGV == 0 and -t STDIN
@ARGV == 0 -t STDIN
Truth table33%1/3
A and B
A= @ARGV == 0B= -t STDIN
ABresult
0X0
100
111
145  
146 1 ▶if (@ARGV > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV > 1) 0 1 1
147 0 print STDERR "pod2usage: Too many filenames given\n\n";
148 0 pod2usage(2);
149 }
150  
151 1 my %usage = ();
152 1 ▶$usage{-input} = shift(@ARGV) || \*STDIN;
Condition50%1/2
shift @ARGV || \*STDIN
l!l
10
MC/DC0%0/1
shift @ARGV || \*STDIN
shift @ARGV
Truth table50%1/2
A
A= shift @ARGV
Aresult
11
00
153 1 ▶$usage{-exitval} = $options{'exit'} if (defined $options{'exit'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"exit"} 0 1 1
154 1 ▶$usage{-output} = $options{'output'} if (defined $options{'output'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"output"} 0 1 1
155 1 ▶$usage{-verbose} = $options{'verbose'} if (defined $options{'verbose'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"verbose"} 0 1 1
156 1 ▶$usage{-pathlist} = $options{'pathlist'} if (defined $options{'pathlist'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"pathlist"} 0 1 1
157 1 ▶$usage{-utf8} = $options{'utf8'} if (defined $options{'utf8'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"utf8"} 0 1 1
158  
159 1 pod2usage(\%usage);
160  
161  
« blib/lib/App/CmdDirs/Traverser/Base.pm ↑ Summary build/build.PL »