Subject: | Vague error message when lookup in Net::Netrc fails |
The error message used to complain about a call to lpa on an undefined value. This patch runs
that in an eval block and returns a more desirable error message.
Subject: | 0001-Added-check-for-Net-Netrc-call.patch |
From acb983fdadf3873667045a926348b0375520ebfd Mon Sep 17 00:00:00 2001
From: William Orr <will@worrbase.com>
Date: Mon, 21 Nov 2011 06:20:52 -0500
Subject: [PATCH] Added check for Net::Netrc call
---
lib/Dist/Zilla/Plugin/Twitter.pm | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/lib/Dist/Zilla/Plugin/Twitter.pm b/lib/Dist/Zilla/Plugin/Twitter.pm
index e7f7029..a94ee2a 100644
--- a/lib/Dist/Zilla/Plugin/Twitter.pm
+++ b/lib/Dist/Zilla/Plugin/Twitter.pm
@@ -102,7 +102,11 @@ sub after_release {
$msg .= " " . $self->hash_tags;
}
- my ($l,$p) = Net::Netrc->lookup('api.twitter.com')->lpa;
+ my ($l, $p);
+
+ eval {
+ ($l,$p) = Net::Netrc->lookup('api.twitter.com')->lpa;
+ } or confess "Can't get Twitter credentials from .netrc";
my $nt = Net::Twitter->new(
useragent_class => $ENV{DZ_TWITTER_USERAGENT} || 'LWP::UserAgent',
traits => [qw/API::REST OAuth/],
--
1.7.7.4