Getopt-App
view release on metacpan or search on metacpan
lib/Getopt/App.pm view on Meta::CPAN
$restore->();
seek $STDERR_CAPTURE, 0, 0;
seek $STDOUT_CAPTURE, 0, 0;
return [join('', <$STDOUT_CAPTURE>), join('', <$STDERR_CAPTURE>), $exit_value];
}
sub extract_usage {
my %pod2usage;
$pod2usage{'-sections'} = shift;
$pod2usage{'-input'} = shift || (caller)[1];
$pod2usage{'-verbose'} = 99 if $pod2usage{'-sections'};
require Pod::Usage;
open my $USAGE, '>', \my $usage;
Pod::Usage::pod2usage(-exitval => 'noexit', -output => $USAGE, %pod2usage);
close $USAGE;
$usage //= '';
$usage =~ s!^(.*?)\n!!s if $pod2usage{'-sections'};
$usage =~ s!^Usage:\n\s+([A-Z])!$1!s; # Remove "Usage" header if SYNOPSIS has a description
( run in 0.778 second using v1.01-cache-2.11-cpan-a3c8064c92c )