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

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Thu Jul 4 17:32:00 2002


User:      heins
Date:      2002-07-04 21:31:20 GMT
Modified:  lib/Vend Interpolate.pm
Log:
* Add the trinary {varname?varname:altvarname} to [attr-list].

Revision  Changes    Path
2.80      +5 -2      interchange/lib/Vend/Interpolate.pm


rev 2.80, prev_rev 2.79
Index: Interpolate.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /anon_cvs/repository/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.79
retrieving revision 2.80
diff -u -r2.79 -r2.80
--- Interpolate.pm	4 Jul 2002 17:19:48 -0000	2.79
+++ Interpolate.pm	4 Jul 2002 21:31:20 -0000	2.80
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 #=20
-# $Id: Interpolate.pm,v 2.79 2002/07/04 17:19:48 mheins Exp $
+# $Id: Interpolate.pm,v 2.80 2002/07/04 21:31:20 mheins Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA =3D qw(Exporter);
=20
-$VERSION =3D substr(q$Revision: 2.79 $, 10);
+$VERSION =3D substr(q$Revision: 2.80 $, 10);
=20
 @EXPORT =3D qw (
=20
@@ -4033,6 +4033,9 @@
 		return undef if ! ref $hash;
 	}
 	$body =3D~ s!\{($Codere)\}!$hash->{$1}!g;
+	$body =3D~ s!\{($Codere)\?($Codere)\:($Codere)\}!
+				length($hash->{$1}) ? $hash->{$2} : $hash->{$3}
+			  !eg;
 	$body =3D~ s!\{($Codere)\|($Some)\}!$hash->{$1} || $2!eg;
 	$body =3D~ s!\{($Codere)\s+($Some)\}! $hash->{$1} ? $2 : ''!eg;
 	$body =3D~ s!\{($Codere)\?\}($Some){/\1\?\}! $hash->{$1} ? $2 : ''!eg;