NAME

App::WWW::CPAN - The implementation of cpanq program

SYNOPSIS

use App::WWW::CPAN ();
App::WWW::CPAN->new->run(@ARGV);

DESCRIPTION

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.

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.

METHODS

new
$app = App::WWW::CPAN->new;

Creates a brand new instance of cpanq program.

parse_args
$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.

do_cmd
$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.

Returns undef on failure.

run
$args->run(@args);

Runs the application with the given command line arguments.

SEE ALSO

cpanq
WWW::CPAN

BUGS

Please report bugs via CPAN RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-CPAN or mailto://bugs-WWW-CPAN@rt.cpan.org.

AUTHORS

Adriano R. Ferreira, <ferreira@cpan.org>

COPYRIGHT AND LICENSE

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.