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

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Sat Feb 9 00:22:00 2002


User:      heins
Date:      2002-02-09 05:21:42 GMT
Modified:  lib/Vend Search.pm
Log:
	* The passed in array reference (from DBI) cannot be modified, so
	  we need to copy it right away.

Revision  Changes    Path
2.5       +8 -8      interchange/lib/Vend/Search.pm


rev 2.5, prev_rev 2.4
Index: Search.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Search.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -r2.4 -r2.5
--- Search.pm	6 Feb 2002 03:49:30 -0000	2.4
+++ Search.pm	9 Feb 2002 05:21:42 -0000	2.5
@@ -1,6 +1,6 @@
 # Vend::Search - Base class for search engines
 #
-# $Id: Search.pm,v 2.4 2002/02/06 03:49:30 mheins Exp $
+# $Id: Search.pm,v 2.5 2002/02/09 05:21:42 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -21,7 +21,7 @@
 
 package Vend::Search;
 
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
 
 use strict;
 use vars qw($VERSION);
@@ -567,6 +567,7 @@
 	else {
 		$code       = "sub {\nmy \$line = shift;\n";
 	}
+	$code .= "my \@fields = \@\$line;\n";
 	my $join_key;
 	$join_key = defined $s->{mv_return_fields} ? $s->{mv_return_fields}[0] : 0;
 	$join_key = 0 if $join_key eq '*';
@@ -607,7 +608,7 @@
 			if($table) {
 				$wild_card = 0;
 				$code .= <<EOF;
-push \@\$line, Vend::Data::database_field('$table', \$key, '$col');
+push \@fields, Vend::Data::database_field('$table', \$key, '$col');
 EOF
 			}
 			elsif ($col =~ tr/:/,/) {
@@ -619,15 +620,15 @@
 				$wild_card = 1;
 				$col =~ s/[^\d,.]//g;
 			$code .= <<EOF;
-my \$addl = join " ", \@\$line[$col];
-push \@\$line, \$addl;
+my \$addl = join " ", \@fields[$col];
+push \@fields, \$addl;
 EOF
 			}
 			else {
 				$wild_card = 1;
 				$code .= <<EOF;
-my \$addl = join " ", \@\$line;
-push \@\$line, \$addl;
+my \$addl = join " ", \@fields;
+push \@fields, \$addl;
 EOF
 			}
 		}
@@ -648,7 +649,6 @@
 		 }
 		 my $callchar = $fields =~ /,/ ? '@' : '$';
 		 $code .= <<EOF;
-	my \@fields = \@\$line;
 	\@fields = ${callchar}fields[$fields];
 EOF
 		$code .= <<EOF if $Global::DebugFile and $CGI::values{debug};