The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

TITLE

cpan-adhoc - Get arbitrary information from a CPAN mirror.

SYNOPSIS

 $ cpan-adhoc
 cpan-adhoc> help
 cpan-adhoc> module LWP::UserAgent
 cpan-adhoc> list
 cpan-adhoc> perldoc lib/LWP/UserAgent.pm
 cpan-adhoc> exit
 
 $ cpan-adhoc http://cpan.pair.com/
 cpan-adhoc> ...
 
 $ cpan-adhoc -help
 $ cpan-adhoc -version

OPTIONS

-help

This option displays the documentation for this script. The script then exits.

-verbose

If asserted, this option causes the banner to be printed and commands echoed when not reading commands from a terminal.

-version

This option displays the version of this script. The script then exits.

DETAILS

This Perl script implements an interactive query of a CPAN mirror. The default is whatever mirror your CPAN client is set to, as determined by CPAN::Access::AdHoc. You can specify a different mirror on the command line, or using the cpan command.

The following commands are supported:

alias

 cpan-adhoc> alias libwww-perl libwww
 cpan-adhoc> alias libwww

This command creates an alias for a distribution in the downloaded distribution stash. It is simply a convenience to save typing if you have a long distribution name you will be repeatedly typing. The first argument is the name of a distribution, and the second is the alias.

The single-argument version creates an alias for the current distribution, if any.

author

 cpan-adhoc> author
 cpan-adhoc> author adamk rjbs bingos

This command lists items from the author index authors/01mailrc.txt.gz. If no names are given the whole index is listed in ASCIIbetical order.

base

This command displays the base directories for the named distributions. If no distribution is specified, the current distribution, if any, is displayed.

cache

This command lists the distribution names encountered since the most-recent clear, or since the script started. Each distribution may appear under multiple names.

cd

 cpan-adhoc> cd fu/bar
 cpan-adhoc> cd

This command changes the default directory under which the script runs. Without an argument, it changes to the user's home directory.

checksums

 cpan-adhoc> checksums MENUHIN
 cpan-adhoc> checksums MENUHIN/Yehudi-0.01.tar.gz

This command displays the checksums for the given author or distribution.

choose

 cpan-adhoc> choose libwww-perl

This command makes the given downloaded distribution the default.

clear

 cpan-adhoc> clear

This command removes all distributions from the stash, and purges cached data from the CPAN::Access::AdHoc object.

corpus

 cpan-adhoc> corpus BACH

This command lists all distributions in the index for the given CPAN ID. More than one CPAN ID can be specified. The CPAN ID is converted to upper case before use, so the example could equally well be written

 cpan-adhoc> corpus bach

Supported options are:

-development

If asserted, development releases are listed; if not asserted they are not. This option is ignored unless -full or -latest is in effect. The default is -development if -production is not asserted.

-full

If asserted, you get full distribution names. If not asserted, you get the base distribution name only. The default is -nofull.

-latest

If asserted, you get the full display, but only the highest-numbered version of any distribution is displayed.

-production

If asserted, production releases are listed; if not asserted they are not. This option is ignored unless -full or -latest is in effect. The default is -production if -development is not asserted.

-verbose

This is just a synonym for -full.

cpan

 cpan-adhoc> cpan
 cpan-adhoc> cpan file:///home/yehudi/Mini-CPAN/
 cpan-adhoc> cpan -default

If no argument is specified, this command displays the CPAN URL being used.

If an argument is specified, this command sets the CPAN URL being used.

If the CPAN URL was specified as -default, a default value is computed from the current setting of default_cpan_source, and that value is both set as the current soure and displayed. If no default can be computed from the current default_cpan_source, an error is displayed and the current setting is left unchanged.

default_cpan_source

 cpan-adhoc> default_cpan_source
 cpan-adhoc> default_cpan_source cpanm,CPAN
 cpan-adhoc> default_cpan_source -default

If no argument is specified, this command displays the sources of default CPAN URLs being used.

If an argument is specified, this command sets the sources of default CPAN URLs. The value is a comma-delimited list.

If the argument was specified as -default, the default value is reinstated.

Note that setting this value does not affect the cpan setting. If you want to recompute the cpan URL after setting this, you must do

 cpan-adhoc> cpan -default

The default is 'CPAN::Mini,cpanm,CPAN,CPANPLUS'.

diff

 cpan-adhoc> diff libwww-perl README README
 cpan-adhoc> diff README README
 cpan-adhoc> diff README
 cpan-adhoc> diff -less -u README README

This command runs diff on a file from a CPAN archive and a local file. The arguments are the distribution name, the file in the distribution, and the local file. The distribution defaults to the current distribution, and the file in the distribution defaults to the local file.

The -less option specifies that the output of diff be viewed in less. Anything else that looks like an option (that is, that has a leading dash) will be passed to the diff program. Because of the possibility of conflict with diff options, -less may not be abbreviated, though it may be specified as --less, or negated -noless.

The null option (--) ends option processing, and causes anything after it to be considered an argument. For example, in

 cpan-adhoc> diff README -readme

the trailing -readme is taken as an option for diff. But in

 cpan-adhoc> diff -- README -readme

the trailing -readme is taken as a file name.

dist

This is a synonym for distribution, for convenience.

distribution

 cpan-adhoc> distribution libwww-perl

This command looks up the given distributions in the module index (sic), using an unanchored regular expression, and displays any matches.

exit

 cpan-adhoc> exit

This command causes the script to exit. An end-of-file also works.

extract

 cpan-adhoc> extract libwww-perl
 cpan-adhoc> extract

This command extracts the files in the given distributions into subdirectories of the current directory. If no distribution is specified, the current distribution is extracted.

help

 cpan-adhoc> help

This command displays the documentation for this script.

info

 cpan-adhoc> info libwww-perl
 cpan-adhoc> info

This command displays the archive name and CPAN ID of the given distributions. If no distribution is specified, the current distribution is displayed.

less

 cpan-adhoc> less libwww-perl lib/LWP/UserAgent.pm
 cpan-adhoc> less libwww-perl LWP::UserAgent
 cpan-adhoc> less lib/LWP/UserAgent.pm
 cpan-adhoc> less LWP::UserAgent

This command feeds the specified file from the specified distribution to whatever pager was configured when Perl was built. If the file is not found, it is assumed to be a module name, and an attempt is made to find that module's file.

The single-argument form attempts to look up the argument in the module index. If it is found, that module's file is displayed. Otherwise it displays the given file in the current distribution, if any

list

 cpan-adhoc> list libwww-perl
 cpan-adhoc> list

This command lists the files in the given distributions. If no distribution is specified, the current distribution is listed.

metadata

This command displays the metadata for the given distributions. If metadata is not available (i.e. no META.json or META.yml was found) a warning will be issued.

The metadata is displayed by the CPAN::Meta as_string() method.

module

 cpan-adhoc> module LWP::UserAgent

This command looks up the given modules in the module index, and displays their version and the distribution they are contained in.

perldoc

 cpan-adhoc> perldoc libwww-perl-6.03 lib/LWP/UserAgent.pm
 cpan-adhoc> perldoc Libwww-perl LWP::UserAgent
 cpan-adhoc> perldoc lib/LWP/UserAgent.pm
 cpan-adhoc> perldoc LWP::UserAgent

This command feeds the specified file from the specified distribution to perldoc. If the file is not found, it is assumed to be a module name, and an attempt is made to find that module's file.

The single-argument form attempts to look up the argument in the module index. If it is found, that module's documentation is displayed. Otherwise it displays the given file in the current distribution, if any

pwd

This command displays the current default directory.

write

 cpan-adhoc> write libwww-perl
 cpan-adhoc> write

This command writes the archive of the given distributions into the current directory. If no distribution is specified, the current distribution is written.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2012-2014 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.