App::WWW::CPAN - The implementation of cpanq program
use App::WWW::CPAN (); App::WWW::CPAN->new->run(@ARGV);
See the documentation of cpanq for the script usage.
This module implements the heart of the cpanq script, which is a simple interface to run API methods of WWW::CPAN via the command line. Currently, this is a work in progress and offered more like an example code for WWW::CPAN.
WWW::CPAN
The expected arguments for the script are like:
command single-arg command key1=val1 key2=val2
where the supported commands by now are search and meta. There is also the synonym commands: query which is the same as search and distmeta an alias of meta.
search Foo # translates to WWW::CPAN->search('Foo') search query=File::Temp mode=all # WWW::CPAN->search({ query => 'File::Temp', mode => 'all' }); meta Foo # WWW::CPAN->fetch_distmeta('Foo'); meta dist=WWW-CPAN version=0.003 # WWW::CPAN->fetch_distmeta({ dist => 'WWW-CPAN', version => '0.003' })
The results are dumped with the help of Data::Dump::Streamer into STDOUT.
$app = App::WWW::CPAN->new;
Creates a brand new instance of cpanq program.
$args = $app->parse_args(@args);
Turns a list like qw( k1=v1 k2=v2 ) into a hash ref { k1 => 'v1', k2 => 'v2' }. If the first element does not match /\A [^=]+ = (.*) \z/x, it returns this first element.
qw( k1=v1 k2=v2 )
{ k1 => 'v1', k2 => 'v2' }
/\A [^=]+ = (.*) \z/x
$out = $args->do_cmd( $method, $args );
Given $method is one of 'query' or 'fetch_distmeta', it evaluates WWW::CPAN->$method($args) and returns the dumped result.
$method
'query'
'fetch_distmeta'
WWW::CPAN->$method($args)
Returns undef on failure.
undef
$args->run(@args);
Runs the application with the given command line arguments.
cpanq WWW::CPAN
Please report bugs via CPAN RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-CPAN or mailto://bugs-WWW-CPAN@rt.cpan.org.
Adriano R. Ferreira, <ferreira@cpan.org>
Copyright (C) 2007, 2008 by Adriano R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::CPAN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::CPAN
CPAN shell
perl -MCPAN -e shell install WWW::CPAN
For more information on module installation, please visit the detailed CPAN module installation guide.