App-PMUtils

 view release on metacpan or  search on metacpan

script/podpath  view on Meta::CPAN

#!perl

use 5.010;
use strict;
use warnings;

use App::PMUtils;
use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-08-30'; # DATE
our $DIST = 'App-PMUtils'; # DIST
our $VERSION = '0.745'; # VERSION

our %SPEC;
$SPEC{podpath} = {
    v => 1.1,
    summary => 'Get path to locally installed POD',
    args => {
        pod => $App::PMUtils::arg_module_multiple,
        all => {
            schema => 'bool',
            cmdline_aliases => {a=>{}},
        },
        abs => {
            schema => 'bool',
            cmdline_aliases => {P=>{}},
        },
    },
};
sub podpath {
    require Module::Path::More;
    my %args = @_;

    my $pods = $args{pod};
    my $res = [];
    my $found;

    for my $pod (@{$pods}) {
        my $mpath = Module::Path::More::module_path(
            module=>$pod, find_pmc=>0, find_pm=>0, find_pod=>1, find_prefix=>0,
            abs=>$args{abs}, all=>$args{all});
        $found++ if $mpath;
        push @$res, @$pods > 1 ? {pod=>$pod, path=>$mpath} : $mpath;
    }

    if ($found) {
        [200, "OK", $res];
    } else {
        [404, "No such POD"];
    }
}

Perinci::CmdLine::Any->new(
    url => '/main/podpath',
    read_config => 0,
    read_env => 0,
)->run;

# ABSTRACT: Get path to locally installed POD
# PODNAME: podpath

__END__

=pod

=encoding UTF-8

=head1 NAME

podpath - Get path to locally installed POD

=head1 VERSION

This document describes version 0.745 of podpath (from Perl distribution App-PMUtils), released on 2024-08-30.

=head1 SYNOPSIS

Basic usage:

 % podpath PSGI

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--abs>, B<-P>

(No description)


=item B<--all>, B<-a>

(No description)


=item B<--pod-json>=I<s>

See C<--pod>.

Can also be specified as the 1st command-line argument and onwards.

=item B<--pod>=I<s@>

(No description)



( run in 0.895 second using v1.01-cache-2.11-cpan-39bf76dae61 )