[interchange-cvs] interchange - heins modified 3 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon Jun 28 17:25:29 EDT 2004
User: heins
Date: 2004-06-28 21:25:28 GMT
Modified: lib/Vend Interpolate.pm SessionDB.pm Util.pm
Log:
* FETCH when there was a conflicting session was returning wrong value.
Revision Changes Path
2.211 +28 -6 interchange/lib/Vend/Interpolate.pm
rev 2.211, prev_rev 2.210
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.210
retrieving revision 2.211
diff -u -r2.210 -r2.211
--- Interpolate.pm 29 Apr 2004 02:47:01 -0000 2.210
+++ Interpolate.pm 28 Jun 2004 21:25:26 -0000 2.211
@@ -1,6 +1,6 @@
# Vend::Interpolate - Interpret Interchange tags
#
-# $Id: Interpolate.pm,v 2.210 2004/04/29 02:47:01 mheins Exp $
+# $Id: Interpolate.pm,v 2.211 2004/06/28 21:25:26 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.210 $, 10);
+$VERSION = substr(q$Revision: 2.211 $, 10);
@EXPORT = qw (
@@ -3067,8 +3067,24 @@
}
return $_[0] !~ $re;
},
+ 'length' => sub {
+ my ($string, $lenspec) = @_;
+ my ($min,$max) = split /-/, $lenspec;
+ if($min and length($string) < $min) {
+ return 0;
+ }
+ elsif($max and length($string) > $max) {
+ return 0;
+ }
+ else {
+ return 0 unless length($string) > 0;
+ }
+ return 1;
+ },
);
+$cond_op{len} = $cond_op{length};
+
sub pull_cond {
my($string, $reverse, $cond, $lhs) = @_;
#::logDebug("pull_cond string='$string' rev='$reverse' cond='$cond' lhs='$lhs'");
@@ -4956,10 +4972,16 @@
return;
}
my ($ary, $fh, $fa) = @$list;
- $opt->{object}{mv_results} = $ary;
- $opt->{object}{matches} = scalar @$ary;
- $opt->{object}{mv_field_names} = $fa if $fa;
- $opt->{object}{mv_field_hash} = $fh if $fh;
+ my $obj = $opt->{object} ||= {};
+ $obj->{mv_results} = $ary;
+ $obj->{matches} = scalar @$ary;
+ $obj->{mv_field_names} = $fa if $fa;
+ $obj->{mv_field_hash} = $fh if $fh;
+ if($opt->{ml}) {
+ $obj->{mv_matchlimit} = $opt->{ml};
+ $obj->{mv_first_match} = $opt->{mv_first_match} || 0;
+ $obj->{mv_next_pointer} = $opt->{mv_first_match} + $opt->{ml};
+ }
return region($opt, $text);
}
2.5 +3 -3 interchange/lib/Vend/SessionDB.pm
rev 2.5, prev_rev 2.4
Index: SessionDB.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/SessionDB.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -r2.4 -r2.5
--- SessionDB.pm 7 Jun 2004 03:44:19 -0000 2.4
+++ SessionDB.pm 28 Jun 2004 21:25:27 -0000 2.5
@@ -1,6 +1,6 @@
# Vend::SessionDB - Stores Interchange session information in files
#
-# $Id: SessionDB.pm,v 2.4 2004/06/07 03:44:19 mheins Exp $
+# $Id: SessionDB.pm,v 2.5 2004/06/28 21:25:27 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
use Vend::Util;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
sub TIEHASH {
my($class, $db) = @_;
@@ -83,7 +83,7 @@
};
my $ary = $sth->fetchrow_arrayref
or return undef;
- return $ary->[0];
+ return $ary->[1];
}
else {
## No session there already
2.73 +27 -13 interchange/lib/Vend/Util.pm
rev 2.73, prev_rev 2.72
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.72
retrieving revision 2.73
diff -u -r2.72 -r2.73
--- Util.pm 28 May 2004 22:38:03 -0000 2.72
+++ Util.pm 28 Jun 2004 21:25:27 -0000 2.73
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.72 2004/05/28 22:38:03 jon Exp $
+# $Id: Util.pm,v 2.73 2004/06/28 21:25:27 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -87,7 +87,7 @@
use Vend::File;
use subs qw(logError logGlobal);
use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.72 $, 10);
+$VERSION = substr(q$Revision: 2.73 $, 10);
my $Eval_routine;
my $Eval_routine_file;
@@ -530,7 +530,7 @@
$r = '';
for ($i = 0; $i < $len; ++$i) {
- $r .= substr($random_chars, int(rand(length($random_chars))), 1);
+ $r .= substr($random_chars, int(rand(length($random_chars))), 1);
}
$r;
}
@@ -707,7 +707,7 @@
close(MVLOGDATA) or die "close\n";
};
if ($@) {
- ::logError ("Could not %s log file '%s': %s\nto log this data:\n%s",
+ logError ("Could not %s log file '%s': %s\nto log this data:\n%s",
$@,
$file,
$!,
@@ -1041,7 +1041,7 @@
$file =~ s#\s+$##;
$file =~ s#\.html?$##;
if($file =~ m{\.\.} and $file =~ /\.\..*\.\./) {
- ::logError( "Too many .. in file path '%s' for security.", $file );
+ logError( "Too many .. in file path '%s' for security.", $file );
$file = find_special_page('violation');
}
$file =~ s#//+#/#g;
@@ -1420,7 +1420,7 @@
}
if($Vend::Cfg->{UserDB} and $Vend::Cfg->{UserDB}{log_failed}) {
my $besthost = $CGI::remote_host || $CGI::remote_addr;
- ::logError("auth error host=%s ip=%s script=%s page=%s",
+ logError("auth error host=%s ip=%s script=%s page=%s",
$besthost,
$CGI::remote_addr,
$CGI::script_name,
@@ -1683,7 +1683,18 @@
sub logError {
my $msg = shift;
- return unless defined $Vend::Cfg;
+ return unless $Vend::Cfg;
+
+ my $opt;
+ if(ref $_[0]) {
+ $opt = shift(@_);
+ }
+ else {
+ $opt = {};
+ }
+
+ $opt->{file} ||= $Vend::Cfg->{ErrorFile};
+
if(@_) {
$msg = errmsg($msg, @_);
}
@@ -1694,11 +1705,11 @@
$msg = format_log_msg($msg) unless $msg =~ s/^\\//;
- $Vend::Errors .= $msg if ($Vend::Cfg->{DisplayErrors} ||
- $Global::DisplayErrors);
+ $Vend::Errors .= $msg
+ if $Vend::Cfg->{DisplayErrors} || $Global::DisplayErrors;
eval {
- open(MVERROR, ">>$Vend::Cfg->{ErrorFile}")
+ open(MVERROR, ">> $opt->{file}")
or die "open\n";
lockfile(\*MVERROR, 1, 1) or die "lock\n";
seek(MVERROR, 0, 2) or die "seek\n";
@@ -1711,7 +1722,7 @@
logGlobal ({ level => 'info' },
"Could not %s error file %s: %s\nto report this error: %s",
$@,
- $Vend::Cfg->{ErrorFile},
+ $opt->{file},
$!,
$msg,
);
@@ -1731,9 +1742,12 @@
# First argument should be log type (see above map).
# Rest of arguments are same as if calling log routine directly.
sub logOnce {
- return if exists $logOnce_cache{"@_"};
+ my $tag = join "", @_;
+ return if exists $logOnce_cache{$tag};
my $log_sub = $log_sub_map{ lc(shift) } || $log_sub_map{error};
- $log_sub->(@_) and ++$logOnce_cache{"@_"};
+ my $status = $log_sub->(@_);
+ $logOnce_cache{$tag} = 1;
+ return $status;
}
More information about the interchange-cvs
mailing list