App-PMUtils

 view release on metacpan or  search on metacpan

script/pmpath  view on Meta::CPAN

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;

Perinci::CmdLine::Any->new(
    url => '/App/PMUtils/pmpath',
    read_config => 0,
    read_env => 0,
)->run;

# ABSTRACT: Get path to locally installed Perl module
# PODNAME: pmpath

__END__

=pod

=encoding UTF-8

=head1 NAME

pmpath - Get path to locally installed Perl module

=head1 VERSION

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

=head1 SYNOPSIS

Basic usage:

 % pmpath Some::Module

Find all modules (-a), return absolute paths (-P):

 % pmpath -aP Some::Module Another::Mod

Pro-tip: install this bash function to be able to cd quickly to directory of
Perl module/prefix (tab completion is also provided):

 # function definition
 cdpm ()
 {
     if [[ "$1" = "" ]]; then echo "Please specify a Perl module/prefix name"; return; fi
     local dir=`pmdir "$1"`
     if [[ "$dir" = "" ]]; then echo "Failed"; else cd "$dir"; fi
 }
 
 # tab completion
 _cdpm ()
 {
     local cur=${COMP_WORDS[COMP_CWORD]}
     COMPREPLY=( `COMP_LINE="pmdir $cur" COMP_POINT=$[6+${#cur}] pmdir` )
 }
 
 # activate tab completion
 complete -F _cdpm cdpm

Afterwards, you can:

 % cdpm di/zi/pl<tab>
 % cdpm Dist/Zilla/Plugin/ _

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

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

Absolutify each path.

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

Get all found files for each module instead of the first one.

=item B<--dir>, B<-d>

Show directory instead of path.

Also, will return C<.> if not found, so you can conveniently do this on a Unix
shell:

 % cd C<pmpath -Pd Moose>

and it won't change directory if the module doesn't exist.


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

See C<--module>.

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

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

(No description)


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

Can be specified multiple times.

=item B<--pm>=I<s>

Default value:

 1

=item B<--pmc>=I<s>



( run in 0.699 second using v1.01-cache-2.11-cpan-5735350b133 )