[libdist-zilla-plugin-githubmeta-perl] 01/04: throw useful errors on git version parse errors

Axel Beckert abe at deuxchevaux.org
Sun Apr 26 22:26:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to annotated tag 0.48
in repository libdist-zilla-plugin-githubmeta-perl.

commit 2de4972403ed15b714b112c261c62c1b296fdcdc
Author: Christian Walde <walde.christian at googlemail.com>
Date:   Fri Feb 20 04:27:07 2015 +0100

    throw useful errors on git version parse errors
---
 lib/Dist/Zilla/Plugin/GithubMeta.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/Dist/Zilla/Plugin/GithubMeta.pm b/lib/Dist/Zilla/Plugin/GithubMeta.pm
index e38acd1..48c4d08 100644
--- a/lib/Dist/Zilla/Plugin/GithubMeta.pm
+++ b/lib/Dist/Zilla/Plugin/GithubMeta.pm
@@ -9,6 +9,7 @@ with 'Dist::Zilla::Role::MetaProvider';
 
 use MooseX::Types::URI qw[Uri];
 use Cwd;
+use Try::Tiny;
 
 use namespace::autoclean;
 
@@ -59,7 +60,9 @@ sub _acquire_repo_info {
     my ($ver) = $gitver =~ m!git version ([0-9.]+)!;
     chomp $gitver;
     require version;
-    if ( version->parse( $ver ) < version->parse('1.5.0') ) {
+    my $ver_obj = try { version->parse( $ver ) }
+      catch { die "'$gitver' not parsable as '$ver': $_" };
+    if ( $ver_obj < version->parse('1.5.0') ) {
       warn "$gitver is too low, 1.5.0 or above is required\n";
       return;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-plugin-githubmeta-perl.git



More information about the Pkg-perl-cvs-commits mailing list