[interchange-cvs] interchange - heins modified 8 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Apr 27 21:54:45 EDT 2005


User:      heins
Date:      2005-04-28 01:54:45 GMT
Modified:  lib/Vend Cart.pm Config.pm Data.pm Dispatch.pm Form.pm
Modified:           Interpolate.pm Parse.pm Ship.pm
Log:
* Various variable initializations and tests to avoid warnings.

Revision  Changes    Path
2.11      +3 -2      interchange/lib/Vend/Cart.pm


rev 2.11, prev_rev 2.10
Index: Cart.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Cart.pm,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -r2.10 -r2.11
--- Cart.pm	17 Nov 2003 14:24:11 -0000	2.10
+++ Cart.pm	28 Apr 2005 01:54:44 -0000	2.11
@@ -1,6 +1,6 @@
 # Vend::Cart - Interchange shopping cart management routines
 #
-# $Id: Cart.pm,v 2.10 2003/11/17 14:24:11 mheins Exp $
+# $Id: Cart.pm,v 2.11 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -25,7 +25,7 @@
 
 package Vend::Cart;
 
-$VERSION = substr(q$Revision: 2.10 $, 10);
+$VERSION = substr(q$Revision: 2.11 $, 10);
 
 use strict;
 
@@ -49,6 +49,7 @@
 	if( ref($cart) eq 'ARRAY' ) {
 		for(keys %$::Carts) {
 #::logDebug("checking name $_ via ref comparison");
+			next unless $::Carts->{$_};
 			$name = $_ if $::Carts->{$_} eq $cart;
 		}
 



2.168     +5 -3      interchange/lib/Vend/Config.pm


rev 2.168, prev_rev 2.167
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.167
retrieving revision 2.168
diff -u -r2.167 -r2.168
--- Config.pm	22 Apr 2005 14:47:37 -0000	2.167
+++ Config.pm	28 Apr 2005 01:54:44 -0000	2.168
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.167 2005/04/22 14:47:37 mheins Exp $
+# $Id: Config.pm,v 2.168 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -49,7 +49,7 @@
 use Vend::File;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.167 $, 10);
+$VERSION = substr(q$Revision: 2.168 $, 10);
 
 my %CDname;
 my %CPname;
@@ -4014,6 +4014,7 @@
 	posroutine		PosRoutine
 	maproutine		MapRoutine
 	noreparse		NoReparse
+	javascriptcheck JavaScriptCheck
 	required		Required
 	routine			Routine
 	version			Version
@@ -4109,7 +4110,8 @@
 	my($tag,$p,$val) = split /\s+/, $value, 3;
 	
 	# Canonicalize
-	$p = $tagCanon{lc $p};
+	$p = $tagCanon{lc $p} || ''
+		or ::logDebug("bizarre mapped code line '$value'");
 	$tag =~ tr/-/_/;
 	$tag =~ s/\W//g
 		and config_warn("Bad characters removed from '%s'.", $tag);



2.47      +5 -3      interchange/lib/Vend/Data.pm


rev 2.47, prev_rev 2.46
Index: Data.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Data.pm,v
retrieving revision 2.46
retrieving revision 2.47
diff -u -r2.46 -r2.47
--- Data.pm	1 Jan 2005 00:09:12 -0000	2.46
+++ Data.pm	28 Apr 2005 01:54:44 -0000	2.47
@@ -1,6 +1,6 @@
 # Vend::Data - Interchange databases
 #
-# $Id: Data.pm,v 2.46 2005/01/01 00:09:12 jon Exp $
+# $Id: Data.pm,v 2.47 2005/04/28 01:54:44 mheins Exp $
 # 
 # Copyright (C) 2002-2004 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -132,6 +132,7 @@
 }
 
 sub database_exists_ref {
+	return unless $_[0];
 	return $_[0]->ref() if ref $_[0];
 	return $Vend::Interpolate::Db{$_[0]}
 			if $Vend::Interpolate::Db{$_[0]};
@@ -1566,7 +1567,8 @@
 					redo CHAIN if ref $row ne 'HASH';
 
 					my $keep;
-					$keep = $row->{$field} if $row->{$field} != 0;
+					$keep = $row->{$field}
+						if length($row->{$field}) && $row->{$field} != 0;
 					for (@breaks) {
 						next unless exists $row->{$_};
 						$test = $_;
@@ -1808,7 +1810,7 @@
 }
 
 sub item_subtotal {
-	item_price($_[0]) * $_[0]->{quantity};
+	item_price($_[0]) * ($_[0]->{quantity} || 0);
 }
 
 sub set_db {



1.51      +5 -5      interchange/lib/Vend/Dispatch.pm


rev 1.51, prev_rev 1.50
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- Dispatch.pm	17 Apr 2005 12:44:39 -0000	1.50
+++ Dispatch.pm	28 Apr 2005 01:54:44 -0000	1.51
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.50 2005/04/17 12:44:39 mheins Exp $
+# $Id: Dispatch.pm,v 1.51 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.50 $, 10);
+$VERSION = substr(q$Revision: 1.51 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -1133,8 +1133,8 @@
 
     my($sessionid, $seed);
 
-	$sessionid = $CGI::values{mv_session_id} || undef;
-	$sessionid =~ s/\0.*//s;
+	$sessionid = $CGI::values{mv_session_id} || undef
+		and $sessionid =~ s/\0.*//s;
 
 	$::Instance->{CookieName} = $Vend::Cfg->{CookieName};
 
@@ -1322,7 +1322,7 @@
 
 	$Vend::Session->{'arg'} = $Vend::Argument = ($CGI::values{mv_arg} || undef);
 
-	if ($CGI::values{mv_pc} =~ /\D/) {
+	if ($CGI::values{mv_pc} and $CGI::values{mv_pc} =~ /\D/) {
 		$Vend::Session->{source} =	$CGI::values{mv_pc} eq 'RESET'
 										? ''
 										: $CGI::values{mv_pc};



2.58      +3 -3      interchange/lib/Vend/Form.pm


rev 2.58, prev_rev 2.57
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.57
retrieving revision 2.58
diff -u -r2.57 -r2.58
--- Form.pm	16 Apr 2005 13:40:29 -0000	2.57
+++ Form.pm	28 Apr 2005 01:54:44 -0000	2.58
@@ -1,6 +1,6 @@
 # Vend::Form - Generate Form widgets
 # 
-# $Id: Form.pm,v 2.57 2005/04/16 13:40:29 mheins Exp $
+# $Id: Form.pm,v 2.58 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -38,7 +38,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.57 $, 10);
+$VERSION = substr(q$Revision: 2.58 $, 10);
 
 @EXPORT = qw (
 	display
@@ -139,7 +139,7 @@
 		.
 		qq({EXTRA?} {EXTRA}{/EXTRA?})
 		.
-		qq(><br$Vend::Xtrailer><textarea cols="{WIDTH}" rows="{HEIGHT}" NAME="{NAME}">{ENCODED}</textarea>{APPEND})
+		qq(><br{XTRAILER}><textarea cols="{WIDTH}" rows="{HEIGHT}" NAME="{NAME}">{ENCODED}</textarea>{APPEND})
 		,
 	text =>
 		qq({PREPEND}<input type="text" name="{NAME}" value="{ENCODED}")



2.242     +5 -2      interchange/lib/Vend/Interpolate.pm


rev 2.242, prev_rev 2.241
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.241
retrieving revision 2.242
diff -u -r2.241 -r2.242
--- Interpolate.pm	27 Apr 2005 22:12:45 -0000	2.241
+++ Interpolate.pm	28 Apr 2005 01:54:44 -0000	2.242
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.241 2005/04/27 22:12:45 mheins Exp $
+# $Id: Interpolate.pm,v 2.242 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.241 $, 10);
+$VERSION = substr(q$Revision: 2.242 $, 10);
 
 @EXPORT = qw (
 
@@ -3923,6 +3923,9 @@
 	if(! length($inc)) {
 		$inc ||= $::Values->{mv_item_alternate} || 2;
 	}
+
+	## We know we are going to do numeric compares on strings, so no warnings
+	no warnings;
 
 	return $count % $inc if $inc >= 1;
 



2.31      +8 -4      interchange/lib/Vend/Parse.pm


rev 2.31, prev_rev 2.30
Index: Parse.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Parse.pm,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -r2.30 -r2.31
--- Parse.pm	27 Apr 2005 22:12:45 -0000	2.30
+++ Parse.pm	28 Apr 2005 01:54:44 -0000	2.31
@@ -1,6 +1,6 @@
 # Vend::Parse - Parse Interchange tags
 # 
-# $Id: Parse.pm,v 2.30 2005/04/27 22:12:45 mheins Exp $
+# $Id: Parse.pm,v 2.31 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -36,7 +36,7 @@
 
 @ISA = qw(Exporter Vend::Parser);
 
-$VERSION = substr(q$Revision: 2.30 $, 10);
+$VERSION = substr(q$Revision: 2.31 $, 10);
 
 @EXPORT = ();
 @EXPORT_OK = qw(find_matching_end);
@@ -187,8 +187,10 @@
 		$default = 1;
 		$opt->{policy} = 'deny';
 	}
-	my @enable  = split /[\s,\0]+/, $enable;
-	my @disable = split /[\s,\0]+/, $opt->{disable};
+	my @enable;
+	my @disable;
+	$enable			and @enable  = split /[\s,\0]+/, $enable;
+	$opt->{disable} and @disable = split /[\s,\0]+/, $opt->{disable};
 
 	for(@enable, @disable) {
 		$_ = lc $_;
@@ -422,6 +424,8 @@
 		if defined $Vend::Cfg->{AdminSub}{$tag} and
 			($Vend::restricted or ! $Vend::admin);
 	
+	no warnings;
+
 	if (! defined $Routine{$tag}) {
         if (! $Alias{$tag}) {
             ::logError("Tag '$tag' not defined.");



2.11      +4 -3      interchange/lib/Vend/Ship.pm


rev 2.11, prev_rev 2.10
Index: Ship.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Ship.pm,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -r2.10 -r2.11
--- Ship.pm	25 Jan 2005 17:47:45 -0000	2.10
+++ Ship.pm	28 Apr 2005 01:54:44 -0000	2.11
@@ -1,6 +1,6 @@
 # Vend::Ship - Interchange shipping code
 # 
-# $Id: Ship.pm,v 2.10 2005/01/25 17:47:45 jon Exp $
+# $Id: Ship.pm,v 2.11 2005/04/28 01:54:44 mheins Exp $
 #
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -628,8 +628,9 @@
 	}
 	elsif($field eq 'quantity') {
 #::logDebug("quantity selection");
-    	foreach $i (0 .. $#$Vend::Items) {
-			$total = $total + $Vend::Items->[$i]->{$field};
+    	for (@$Vend::Items) {
+			next unless $_->{quantity};
+			$total = $total + $_->{quantity};
     	}
 	}
 	elsif ( index($field, ':') != -1) {








More information about the interchange-cvs mailing list