The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MetaCPAN::Helper - a MetaCPAN client that provides some high-level helper functions

SYNOPSIS

 use MetaCPAN::Helper;

 my $helper   = MetaCPAN::Helper->new();
 my $module   = 'MetaCPAN::Client';
 my $distname = $helper->module2dist($module);
 print "$module is in dist '$distname'\n";

DESCRIPTION

This module is a helper class built on top of MetaCPAN::Client, providing methods which provide simple high-level functions for answering common "CPAN lookup questions".

Note: this is an early release, and the interface is likely to change. Feedback on the interface is very welcome.

You could just use MetaCPAN::Client directly yourself, which might make sense in a larger application. This class is aimed at people writing smaller one-off scripts.

METHODS

module2dist( $MODULE_NAME | $MODULE_OBJ )

Takes the name of a module or a MetaCPAN::Client::Module object, and returns the name of the distribution which currently contains that module, according to the MetaCPAN API.

At the moment this will ignore any developer releases, and take the latest non-developer release of the module.

If the distribution name in the dist's metadata doesn't match the name produced by CPAN::DistnameInfo, then be aware that this method returns the name according to CPAN::DistnameInfo. This doesn't happen very often (less than 0.5% of CPAN distributions).

Takes the name of a release or a MetaCPAN::Client::Release object, and returns the repo URL string or undef if not found.

Takes the name of a distribution or a MetaCPAN::Client::Distribution object, and returns the repo URL string or undef if not found, of its latest release.

dist2releases( $DIST_NAME | $DIST_OBJ )

Takes the name of a distribution or a MetaCPAN::Client::Distribution object, and returns the MetaCPAN::Client::ResultSet iterator of all releases (as MetaCPAN::Client::Release objects) associated with that distribution.

dist2latest_release( $DIST_NAME | $DIST_OBJ )

Takes the name of a distribution or a MetaCPAN::Client::Distribution object, and returns the MetaCPAN::Client::Release object of the "latest" release of that distribution.

dist2favorite_count( $DIST_NAME | $DIST_OBJ )

Takes the name of a distribution or a MetaCPAN::Client::Distribution object, and returns the favorites count for that distribution.

SEE ALSO

MetaCPAN::Client - the definitive client for querying MetaCPAN.

REPOSITORY

https://github.com/CPAN-API/metacpan-helper

CONTRIBUTORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 the MetaCPAN project.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 152:

Unknown directive: =head

Around line 157:

Unknown directive: =head