=================================================================== RCS file: /cvs/HOPE/Net-OpenAMD/lib/Net/OpenAMD.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- HOPE/Net-OpenAMD/lib/Net/OpenAMD.pm 2010/06/28 18:49:31 1.11 +++ HOPE/Net-OpenAMD/lib/Net/OpenAMD.pm 2010/06/28 21:32:32 1.12 @@ -1,15 +1,14 @@ package Net::OpenAMD; -# $AFresh1: OpenAMD.pm,v 1.10 2010/06/27 03:59:32 andrew Exp $ +# $AFresh1: OpenAMD.pm,v 1.11 2010/06/28 17:49:31 andrew Exp $ +use version; our $VERSION = qv('0.0.1'); +my $BASE_URI = 'https://api.hope.net/api/'; + use warnings; use strict; use Carp; -use version; our $VERSION = qv('0.0.1'); - -my $BASE_URI = 'https://api.hope.net/api/'; - use Scalar::Util qw( refaddr ); *_ident = \&refaddr; @@ -27,7 +26,7 @@ my $self = bless do { \my $x }, $class; my $ident = _ident($self); - $options //= {}; + $options ||= {}; croak 'Options should be a hashref' if ref $options ne 'HASH'; @@ -47,11 +46,8 @@ $uri->query($query); my $response = $ua_of{$ident}->get($uri); + croak $response->status_line if !$response->is_success; - if ( !$response->is_success ) { - croak $response->status_line; - } - return JSON::Any->jsonToObj( $response->decoded_content ); } @@ -77,6 +73,7 @@ 1; # Magic true value required at end of module __END__ + =head1 NAME Net::OpenAMD - Perl interface to the OpenAMD API