Permalink
Browse files

Work out the latest version ourselves

  • Loading branch information...
ranguard committed Jun 21, 2011
1 parent af1d5e8 commit cf54d662a697ea6c3c2c167e5635cb8545612239
Showing with 7 additions and 3 deletions.
  1. +7 −3 bin/cpanorg_perl_releases
View
@@ -36,6 +36,7 @@ $perl_versions = sort_versions($perl_versions);
= extract_first_per_version_in_list($perl_versions);
my $latest = sort_versions( [ values %{$latest_per_version} ] );
+ $latest->[0]->{latest} = 'true';
print_file( "perl_version_latest_stable.json",
$json->encode( $latest->[0] ) );
@@ -89,7 +90,7 @@ sub extract_first_per_version_in_list {
sub fetch_perl_version_data {
my $perl_dist_url = "http://search.cpan.org/api/dist/perl";
- my $filename = 'perl_version_all.json';
+ my $filename = 'perl_version_all.json';
# See what we have on disk
my $disk_json = '';
@@ -106,11 +107,11 @@ sub fetch_perl_version_data {
} else {
# Save for next fetch
- print_file( $filename, $cpan_json );
+ print_file( $filename, $cpan_json );
}
my $data = eval { $json->decode($cpan_json) };
- if (my $err = $@) {
+ if ( my $err = $@ ) {
die "$err: [$cpan_json]";
}
@@ -129,6 +130,9 @@ sub fetch_perl_version_data {
$module->{version_minor} = int($minor);
$module->{version_iota} = int( $iota || '0' );
+ # Do not trust the API as it gets it wrong
+ delete $module->{latest};
+
$module->{type}
= $module->{status} eq 'testing'
? 'Devel'

0 comments on commit cf54d66

Please sign in to comment.