16 my $pid = open(IN, "-|");
17 unless(defined $pid) {
18 die "Cannot fork: $!";
25 print "\nEXIT=$exit OUTPUT=+++\n@out+++\n";
26 return($exit, join("",@out));
29 open(STDERR, ">&STDOUT");
31 print "--NORMAL-RETURN--\n";
37 my ($left,$right) = @_;
38 $left =~ s/[
\r\n]+/\n/sg;
39 $right =~ s/[
\r\n]+/\n/sg;
46 my ($exit, $text) = getoutput( sub { pod2usage() } );
47 ok($exit == 2 && compare($text, <<'EOT'));
49 frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ...
54 ($exit, $text) = getoutput( sub { pod2usage(
55 -message => 'You naughty person, what did you say?',
57 ok($exit == 1 && compare($text,<<'EOT'));
58 You naughty person, what did you say?
60 frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ...
70 Specify number of frobs, default is 42.
75 ($exit, $text) = getoutput( sub { pod2usage(
76 -verbose => 2, -exit => 42 ) } );
77 ok($exit == 42 && compare($text,<<'EOT'));
79 frobnicate - do what I mean
82 frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ...
85 frobnicate does foo and bar and what not.
95 Specify number of frobs, default is 42.
100 ($exit, $text) = getoutput( sub { pod2usage(0) } );
101 ok($exit == 0 && compare($text, <<'EOT'));
103 frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ...
113 Specify number of frobs, default is 42.
118 ($exit, $text) = getoutput( sub { pod2usage(42) } );
119 ok($exit == 42 && compare($text, <<'EOT'));
121 frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ...
126 ($exit, $text) = getoutput( sub { pod2usage(-verbose => 0, -exit => 'NOEXIT') } );
127 ok($exit == 0 && compare($text, <<'EOT'));
129 frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ...
135 ($exit, $text) = getoutput( sub { pod2usage(-verbose => 99, -sections => 'DESCRIPTION') } );
136 ok($exit == 1 && compare($text, <<'EOT'));
138 frobnicate does foo and bar and what not.
148 frobnicate - do what I mean
152 B<frobnicate> S<[ B<-r> | B<--recursive> ]> S<[ B<-f> | B<--force> ]>
153 S<[ B<-n> I<number> ]> I<file> ...
157 B<frobnicate> does foo and bar and what not.
163 =item B<-r> | B<--recursive>
167 =item B<-f> | B<--force>
171 =item B<-n> I<number>
173 Specify number of frobs, default is 42.