koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Amazon.pm [rel_2_2]


From: Joshua Ferraro
Subject: [Koha-cvs] koha/C4 Amazon.pm [rel_2_2]
Date: Tue, 27 Feb 2007 15:55:26 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     Joshua Ferraro <kados>  07/02/27 15:55:26

Modified files:
        C4             : Amazon.pm 

Log message:
        better error handling for Amazon.com module

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Amazon.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.3.2.4&r2=1.3.2.5

Patches:
Index: Amazon.pm
===================================================================
RCS file: /sources/koha/koha/C4/Amazon.pm,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.4 -r1.3.2.5
--- Amazon.pm   4 Mar 2006 03:24:51 -0000       1.3.2.4
+++ Amazon.pm   27 Feb 2007 15:55:26 -0000      1.3.2.5
@@ -48,6 +48,7 @@
 
 sub get_amazon_details {
        my ( $isbn ) = @_;
+       my $error;
 
        #get rid of MARC cataloger's nonsense
        $isbn =~ s/(p|-)//g;
@@ -61,12 +62,15 @@
        my $asin=$isbn;
        my $url = 
"http://xml.amazon.com/onca/xml3?t=$af_tag&dev-t=$dev_key&type=heavy&f=xml&AsinSearch=";
 . $asin;
        my $content = get($url);
-       warn "could not retrieve $url" unless $content;
+       unless ($content) {
+               warn "could not retrieve $url";
+               return ("error","");
+       }
        my $xmlsimple = XML::Simple->new();
        my $response = $xmlsimple->XMLin($content,
        forcearray => [ qw(Details Product AvgCustomerRating CustomerReview) ],
-);
-       return $response;
+                       );
+       return ($error, $response);
 }
 
 =head1 NOTES




reply via email to

[Prev in Thread] Current Thread [Next in Thread]