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

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Apr 18 08:12:28 EDT 2005


User:      heins
Date:      2005-04-18 12:12:28 GMT
Modified:  lib/Vend Parser.pm
Log:
* Allow ITL interpolation of reference-based ITL attributes
  if Pragma interpolate_itl_references is set. Allows construction:

	[tmp testing]foobar'ed[/tmp]
	[record
		table=inventory
		key=newkey
		col.quantity=300
		col.stock_message="[scratch testing]"
		]

* Change reference determination tests to the more canonical
  "ref($el) eq 'TYPE'".

Revision  Changes    Path
2.10      +7 -4      interchange/lib/Vend/Parser.pm


rev 2.10, prev_rev 2.9
Index: Parser.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Parser.pm,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -r2.9 -r2.10
--- Parser.pm	18 Jun 2003 17:34:44 -0000	2.9
+++ Parser.pm	18 Apr 2005 12:12:28 -0000	2.10
@@ -1,6 +1,6 @@
 # Vend::Parser - Interchange parser class
 #
-# $Id: Parser.pm,v 2.9 2003/06/18 17:34:44 jon Exp $
+# $Id: Parser.pm,v 2.10 2005/04/18 12:12:28 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1997-2002 Red Hat, Inc.
@@ -68,7 +68,7 @@
 
 use HTML::Entities ();
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.9 $, 10);
+$VERSION = substr(q$Revision: 2.10 $, 10);
 
 
 sub new
@@ -205,6 +205,9 @@
 					}
 					if(defined $element) {
 #::logDebug("Found element: $element val=$val");
+						$val = Vend::Interpolate::interpolate_html($val)
+							if  $::Pragma->{interpolate_itl_references}
+							and $val =~ /\[\w[-\w]*\s+.*]/s;
 						if(! ref $attr{$attr}) {
 							if ($element =~ /[A-Za-z]/) {
 								$attr{$attr} = { $element => $val };
@@ -215,7 +218,7 @@
 							}
 							push (@attrseq, $attr);
 						}
-						elsif($attr{$attr} =~ /ARRAY/) {
+						elsif(ref($attr{$attr}) eq 'ARRAY') {
 							if($element =~ /\D/) {
 								push @{$attr{$attr}}, $val;
 							}
@@ -223,7 +226,7 @@
 								$attr{$attr}->[$element] = $val;
 							}
 						}
-						elsif ($attr{$attr} =~ /HASH/) {
+						elsif (ref($attr{$attr}) eq 'HASH') {
 							$attr{$attr}->{$element} = $val;
 						}
 						undef $element;








More information about the interchange-cvs mailing list