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

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Thu Jan 24 02:04:01 2002


User:      jon
Date:      2002-01-24 07:03:31 GMT
Modified:  lib/Vend Interpolate.pm
Log:
Fix [filter cgi] and [filter value], as per bug #380.

I don't see any way the old code could have *not* resulted in a Perl error,
but I may be totally misunderstanding the intention. But according to my
reading of the docs ("good way to get a starting value for a filter set")
and the code, this is how this should work:

when CGI foo = bar:

[filter cgi]foo[/filter] => bar

If this is correct, I'll commit the change to 4.8 as well.

Thanks to Jonathan Clark <jonc@webmaint.net> for reporting.

Revision  Changes    Path
2.42      +6 -4      interchange/lib/Vend/Interpolate.pm


rev 2.42, prev_rev 2.41
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -u -r2.41 -r2.42
--- Interpolate.pm	22 Jan 2002 02:34:40 -0000	2.41
+++ Interpolate.pm	24 Jan 2002 07:03:30 -0000	2.42
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.41 2002/01/22 02:34:40 mheins Exp $
+# $Id: Interpolate.pm,v 2.42 2002/01/24 07:03:30 jon Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.41 $, 10);
+$VERSION = substr(q$Revision: 2.42 $, 10);
 
 @EXPORT = qw (
 
@@ -915,10 +915,12 @@
 %Filter = (
 	
 	'value' =>	sub {
-					return $::Values->(shift);
+					my $var = shift;
+					return $var ? $::Values->{$var} : '';
 				},
 	'cgi' =>	sub {
-					return $CGI::values(shift);
+					my $var = shift;
+					return $var ? $CGI::values{$var} : '';
 				},
 	'filesafe' =>	sub {
 						return Vend::Util::escape_chars(shift);