From 0977df2d6922eb02c36fa057ccc52ae554e858e8 Mon Sep 17 00:00:00 2001 From: Brian Cassidy Date: Thu, 8 Dec 2011 11:43:29 -0400 Subject: remove unused var; simplify conditions --- lib/Net/HTTP/Spore.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/Net') diff --git a/lib/Net/HTTP/Spore.pm b/lib/Net/HTTP/Spore.pm index 87454c9..356d376 100644 --- a/lib/Net/HTTP/Spore.pm +++ b/lib/Net/HTTP/Spore.pm @@ -88,13 +88,8 @@ sub _attach_spec_to_class { }; try { - my $base_url; - if ( $spec->{base_url} && !$opts->{base_url} ) { - $opts->{base_url} = $spec->{base_url}; - } - elsif ( !$opts->{base_url} ) { - die "base_url is missing!"; - } + $opts->{base_url} ||= $spec->{base_url}; + die "base_url is missing!" if !$opts->{base_url}; if ( $spec->{formats} ) { $opts->{formats} = $spec->{formats}; -- cgit 1.4.1 From 982cae563e0686b3be23f27d3e18a35edef36090 Mon Sep 17 00:00:00 2001 From: Brian Cassidy Date: Thu, 8 Dec 2011 11:48:07 -0400 Subject: confess when we are unable to fetch a spec via LWP --- lib/Net/HTTP/Spore.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Net') diff --git a/lib/Net/HTTP/Spore.pm b/lib/Net/HTTP/Spore.pm index 356d376..ce56c92 100644 --- a/lib/Net/HTTP/Spore.pm +++ b/lib/Net/HTTP/Spore.pm @@ -121,6 +121,10 @@ sub _read_spec { my $req = HTTP::Request->new( GET => $spec_file ); my $ua = LWP::UserAgent->new(); my $res = $ua->request($req); + unless( $res->is_success ) { + my $status = $res->status_line; + Carp::confess("Unabled to fetch $spec_file ($status)"); + } $content = $res->content; } else { -- cgit 1.4.1 From 69b0ad93e0b673cb227b05bc11a064527c510cb1 Mon Sep 17 00:00:00 2001 From: Brian Cassidy Date: Thu, 8 Dec 2011 12:03:35 -0400 Subject: pod fix --- lib/Net/HTTP/Spore.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Net') diff --git a/lib/Net/HTTP/Spore.pm b/lib/Net/HTTP/Spore.pm index ce56c92..5c4f0c7 100644 --- a/lib/Net/HTTP/Spore.pm +++ b/lib/Net/HTTP/Spore.pm @@ -214,7 +214,7 @@ L provides a way to trace what's going on when doing a request =head3 Enabling Trace -You can enable tracing using the environment variable B. You can also enable tracing at construct time by adding B 1> when calling B. +You can enable tracing using the environment variable B. You can also enable tracing at construct time by adding B 1> when calling B. =head3 Trace Output -- cgit 1.4.1 From 84acaa54e6cd6447568e2c0d67906116926635c8 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Mon, 2 Jan 2012 15:12:21 -0800 Subject: use eq and ne instead of a regex --- lib/Net/HTTP/Spore/Meta/Method/Spore.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 lib/Net/HTTP/Spore/Meta/Method/Spore.pm (limited to 'lib/Net') diff --git a/lib/Net/HTTP/Spore/Meta/Method/Spore.pm b/lib/Net/HTTP/Spore/Meta/Method/Spore.pm old mode 100644 new mode 100755 index 9ebe5f0..b046b04 --- a/lib/Net/HTTP/Spore/Meta/Method/Spore.pm +++ b/lib/Net/HTTP/Spore/Meta/Method/Spore.pm @@ -37,14 +37,14 @@ sub find_spore_method_by_name { sub remove_spore_method { my ($meta, $name) = @_; - my @methods = grep { !/$name/ } $meta->get_all_spore_methods; + my @methods = grep { $_ ne $name } $meta->get_all_spore_methods; $meta->local_spore_methods(\@methods); $meta->remove_method($name); } before add_spore_method => sub { my ($meta, $name) = @_; - if ($meta->_find_spore_method_by_name(sub {/^$name$/})) { + if ($meta->_find_spore_method_by_name(sub {$_ eq $name})) { confess "method '$name' is already delcared in ".$meta->name; } }; -- cgit 1.4.1