Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding 'use version to Inquiry.pm

  • Loading branch information...
commit ca66d276e3a5fb56bc2a526775a92fec0e1312d3 1 parent 44181bc
@semuel authored
Showing with 31 additions and 2 deletions.
  1. +18 −0 lib/Dist/Surveyor.pm
  2. +13 −2 lib/Dist/Surveyor/Inquiry.pm
View
18 lib/Dist/Surveyor.pm
@@ -79,6 +79,24 @@ A hash-ref, with a list of irregular named releases. i.e. 'libwww-perl' => 'LWP'
$search_dirs is an array-ref containing the list of directories to survey.
+Returns a list, where each element is a hashref representing one installed distibution.
+This hashref is what MetaCPAN returns for http://api.metacpan.org/v0/release/$author/$release,
+with two additional keys:
+
+=over
+
+=item *
+
+'url' - that same as 'download_url', but without the hostname. can be used to
+download the file for your favorite mirror
+
+=item *
+
+'dist_data' - Hashref containing info about the release, i.e. percent_installed.
+(fully installed releases will have '100.00')
+
+=back
+
=cut
sub determine_installed_releases {
View
15 lib/Dist/Surveyor/Inquiry.pm
@@ -9,6 +9,7 @@ use LWP::UserAgent;
use JSON;
use Scalar::Util qw(looks_like_number); # core
use Data::Dumper;
+use version;
=head1 NAME
@@ -40,8 +41,6 @@ For initating cache-on-disk, call Dist::Surveyor::Inquiry->perma_cache()
=back
-=head1 FUNCTIONS
-
=cut
# We have to limit the number of results when using MetaCPAN::API.
@@ -72,6 +71,16 @@ our @EXPORT = qw{
my %memoize_cache;
my $locking_file;
+=head1 CLASS METHODS
+
+=head2 Dist::Surveyor::Inquiry->perma_cache()
+
+Enable caching to disk of all the MetaCPAN API requests.
+This cache can grew to be quite big - 40MB is one case, but it worth it,
+as if you will need to run this program again, it will run much faster.
+
+=cut
+
sub perma_cache {
my $class = shift;
my $db_generation = 3; # XXX increment on incompatible change
@@ -100,6 +109,8 @@ for my $subname (@memoize_subs) {
memoize($subname, %memoize_args);
}
+=head1 FUNCTIONS
+
=head2 get_release_info($author, $release)
Receive release info, such as:
Please sign in to comment.
Something went wrong with that request. Please try again.