Skip to content

Instantly share code, notes, and snippets.

@draegtun
Created September 17, 2010 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save draegtun/584025 to your computer and use it in GitHub Desktop.
Save draegtun/584025 to your computer and use it in GitHub Desktop.
Get perl version releases using its git tags
#!/usr/bin/env perl
use 5.012;
use warnings;
use Net::GitHub::V2::Repositories;
my $github = Net::GitHub::V2::Repositories->new(
owner => 'mirrors', repo => 'perl',
);
my @versions;
my $tags = $github->tags;
for my $tag (keys %$tags) {
# just perl5 since 5.6
if ($tag =~ m/^(perl-|v)5\.(\d+)\.(\d+)(.*)/) {
push @versions, [5, $2, $3, $4];
}
}
sub by_version {
$b->[0] <=> $a->[0] ||
$b->[1] <=> $a->[1] ||
$b->[2] <=> $a->[2];
}
sub format_version { sprintf "perl-%d.%d.%d%s", @_ }
# print versions from latest to oldest
for my $version (sort by_version @versions) {
next if $version->[3] =~ m/RC/; # <= exclude release candidates
next if $version->[1] % 2 != 0; # <= exclude development versions
say format_version( @$version );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment