[interchange-cvs] interchange - jon modified lib/Vend/Interpolate.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Fri Jan 24 00:09:00 2003


User:      jon
Date:      2003-01-24 05:08:54 GMT
Modified:  lib/Vend Tag: STABLE_4_8-branch Interpolate.pm
Log:
Merge from trunk:

Tolerate following previously unallowed constructs:

[if-loop-param fieldname =~ /abc/i]
(and/or options s, m, x)

[if-loop-param fieldname =~ /abc/ ]
(trailing space caused regex compilation to fail before)

Revision  Changes    Path
No                   revision



No                   revision



2.9.2.28  +6 -4      interchange/lib/Vend/Interpolate.pm


rev 2.9.2.28, prev_rev 2.9.2.27
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.9.2.27
retrieving revision 2.9.2.28
diff -u -u -r2.9.2.27 -r2.9.2.28
--- Interpolate.pm	24 Jan 2003 04:53:52 -0000	2.9.2.27
+++ Interpolate.pm	24 Jan 2003 05:08:54 -0000	2.9.2.28
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.9.2.27 2003/01/24 04:53:52 jon Exp $
+# $Id: Interpolate.pm,v 2.9.2.28 2003/01/24 05:08:54 jon Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. and
 # Interchange Development Group, http://www.icdevgroup.org/
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.9.2.27 $, 10);
+$VERSION = substr(q$Revision: 2.9.2.28 $, 10);
 
 @EXPORT = qw (
 
@@ -3754,7 +3754,8 @@
    '!=' => sub { $_[0] != $_[1] },
    '=~' => sub { 
    				 my $re;
-				 $_[1] =~ s:^/(.*)/$:$1:;
+				 $_[1] =~ s:^/(.*)/([imsx]*)\s*$:$1:;
+				 $2 and substr($_[1], 0, 0) = "(?$2)";
    				 eval { $re = qr/$_[1]/ };
 				 if($@) {
 					::logError("bad regex %s in if-PREFIX-data", $_[1]);
@@ -3764,7 +3765,8 @@
 				},
    '!~' => sub { 
    				 my $re;
-				 $_[1] =~ s:^/(.*)/$:$1:;
+				 $_[1] =~ s:^/(.*)/([imsx]*)\s*$:$1:;
+				 $2 and substr($_[1], 0, 0) = "(?$2)";
    				 eval { $re = qr/$_[1]/ };
 				 if($@) {
 					::logError("bad regex %s in if-PREFIX-data", $_[1]);