mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-02-04 07:12 pm

[dw-free] Support Google Checkout

[commit: http://hg.dwscoalition.org/dw-free/rev/14f211f79287]

http://bugs.dwscoalition.org/show_bug.cgi?id=2321

Make Google Checkout modules optional.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Shop/Engine/GoogleCheckout.pm
--------------------------------------------------------------------------------
diff -r f30c9dfe7830 -r 14f211f79287 cgi-bin/DW/Shop/Engine/GoogleCheckout.pm
--- a/cgi-bin/DW/Shop/Engine/GoogleCheckout.pm	Wed Feb 03 01:21:16 2010 +0000
+++ b/cgi-bin/DW/Shop/Engine/GoogleCheckout.pm	Thu Feb 04 19:12:38 2010 +0000
@@ -20,12 +20,25 @@ use strict;
 use strict;
 use Carp qw/ croak confess /;
 use Storable qw/ nfreeze thaw /;
+
+
+# put these in an eval ... most people won't actually be using Google Checkout,
+# so we don't want to force (e.g.) development environments to have to install
+# these modules.  however, if someone DOES want to use GCO, then they need to
+# make sure these modules are installed ...
+BEGIN {
+    my $rv = eval <<USE;
 use Google::Checkout::General::GCO;
 use Google::Checkout::General::MerchantCheckoutFlow;
 use Google::Checkout::General::DigitalContent;
 use Google::Checkout::General::ShoppingCart;
 use Google::Checkout::Command::ChargeOrder;
 use Google::Checkout::General::Util qw/ is_gco_error /;
+1;
+USE
+    warn "NOTE: Google::Checkout::* Perl modules were not found.\n"
+        unless $rv;
+}
 
 use base qw/ DW::Shop::Engine /;
 
--------------------------------------------------------------------------------