[interchange-cvs] interchange - heins modified lib/Vend/Ship.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Sat Apr 30 10:52:55 EDT 2005


User:      heins
Date:      2005-04-30 14:52:55 GMT
Modified:  lib/Vend Ship.pm
Log:
* Incorporate "use strict" for this module.

* Improve handling of ship_message.

* Avoid some warnings.

Revision  Changes    Path
2.12      +11 -6     interchange/lib/Vend/Ship.pm


rev 2.12, prev_rev 2.11
Index: Ship.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Ship.pm,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -r2.11 -r2.12
--- Ship.pm	28 Apr 2005 01:54:44 -0000	2.11
+++ Ship.pm	30 Apr 2005 14:52:55 -0000	2.12
@@ -1,6 +1,6 @@
 # Vend::Ship - Interchange shipping code
 # 
-# $Id: Ship.pm,v 2.11 2005/04/28 01:54:44 mheins Exp $
+# $Id: Ship.pm,v 2.12 2005/04/30 14:52:55 mheins Exp $
 #
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -35,6 +35,8 @@
 use Vend::Util;
 use Vend::Interpolate;
 use Vend::Data;
+use strict;
+no warnings qw(uninitialized numeric);
 
 use constant MAX_SHIP_ITERATIONS => 100;
 use constant MODE  => 0;
@@ -82,6 +84,8 @@
 	return $zone;
 }
 
+use vars qw/%Ship_handler/;
+
 %Ship_handler = (
 		TYPE =>
 					sub { 
@@ -756,7 +760,7 @@
 		}
 		elsif ($what =~ s/^s\s*//) {
 			$what =~ s/\s+(.*)//;
-			$extra = $1;
+			my $extra = $1;
 			my $loc = $Vend::Cfg->{Shipping_repository}{$what}
 				or return do_error("Unknown custom shipping type '%s'", $what);
 			for(keys %$loc) {
@@ -919,10 +923,11 @@
 	}
 
 	# If we got here, the mode and quantity fit was not found
-	$Vend::Session->{ship_message} .=
-		"No match found for mode '$mode', quantity '$total', "	.
-		($qual ? "qualifier '$qual', " : '')					.
-		"returning 0. ";
+	$Vend::Session->{ship_message} ||= '';
+	my $fmt = "No match found for mode '%s', quantity '%s', ";
+	$fmt .= "qualifier '%s', " if $qual;
+	$fmt .= "returning 0.";
+	$Vend::Session->{ship_message} .= errmsg($fmt, $mode, $total, $qual);
 	return undef;
 }
 








More information about the interchange-cvs mailing list