App-PlUtils
view release on metacpan or search on metacpan
script/pldoc view on Meta::CPAN
#!perl
our $DATE = '2020-04-29'; # DATE
our $VERSION = '0.122'; # VERSION
use 5.010;
use strict;
use warnings;
use App::PlUtils;
use File::Which;
use Perinci::CmdLine::Any;
our %SPEC;
$SPEC{pldoc} = {
v => 1.1,
summary => 'Show documentation of Perl script',
description => <<'_',
This function executes <prog:perldoc>. Basically what it offers is command-line
completion.
_
args => {
file => $App::PlUtils::arg_file_single,
},
deps => {
prog => 'perldoc',
},
};
sub pldoc {
my %args = @_;
my $file = $args{file};
if (!(-f $file) && $file !~ m!/!) {
# search file in PATH
$file = which($file);
}
unless (-f $file) {
return [404, "No such file '$args{file}'"];
}
my @cmd = ("perldoc", $file);
exec @cmd;
# [200]; # unreachable
}
Perinci::CmdLine::Any->new(
url => '/main/pldoc',
read_config => 0,
read_env => 0,
)->run;
# ABSTRACT: Show documentation of Perl script
# PODNAME: pldoc
__END__
=pod
=encoding UTF-8
=head1 NAME
pldoc - Show documentation of Perl script
=head1 VERSION
This document describes version 0.122 of pldoc (from Perl distribution App-PlUtils), released on 2020-04-29.
=head1 SYNOPSIS
Basic usage:
% pldoc <perl-script>
=head1 DESCRIPTION
This function executes L<perldoc>. Basically what it offers is command-line
completion.
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--file>=I<s>*
Perl script.
For convenience, if filename does not contain path separator, it will first be
searched in the current directory, then in `PATH` (using `File::Which`).
=back
=head2 Output options
( run in 1.291 second using v1.01-cache-2.11-cpan-39bf76dae61 )