[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Sun Apr 17 08:44:39 EDT 2005


User:      heins
Date:      2005-04-17 12:44:39 GMT
Modified:  lib/Vend Config.pm Dispatch.pm
Log:
* Add ability to specify multiple Autoload and AutoEnd routines
  with separate lines.

  Prior to this, if you wanted to run multiple autoload routines
  you had to specify them all on one line, and you couldn't mix
  ITL code in.

  Now you can (for both Autoload and AutoEnd) specify one routine at
  the top of the configuration file, then another on a later line.

  This *could* have the effect of changing catalog operation if
  someone currently has multiple lines -- in previous versions this
  would cause the last line to take precedence.

* Add ability for multiple AutoEnd routines by having it use
  run_macro() as it *should* have before.

Revision  Changes    Path
2.165     +40 -4     interchange/lib/Vend/Config.pm


rev 2.165, prev_rev 2.164
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.164
retrieving revision 2.165
diff -u -r2.164 -r2.165
--- Config.pm	14 Apr 2005 15:13:14 -0000	2.164
+++ Config.pm	17 Apr 2005 12:44:39 -0000	2.165
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.164 2005/04/14 15:13:14 mheins Exp $
+# $Id: Config.pm,v 2.165 2005/04/17 12:44:39 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -49,7 +49,7 @@
 use Vend::File;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.164 $, 10);
+$VERSION = substr(q$Revision: 2.165 $, 10);
 
 my %CDname;
 my %CPname;
@@ -430,8 +430,8 @@
 	['DatabaseAuto',	 'dbauto',	     	 ''],
 	['DatabaseAutoIgnore',	 'regex',	     	 ''],
 	['Database',  		 'database',     	 ''],
-	['Autoload',		 undef,		     	 ''],
-	['AutoEnd',			 undef,		     	 ''],
+	['Autoload',		 'routine_array',	 ''],
+	['AutoEnd',			 'routine_array',	 ''],
 	['Replace',			 'replace',     	 ''],
 	['Member',		  	 'variable',     	 ''],
 	['WritePermission',  'permission',       'user'],
@@ -2809,6 +2809,42 @@
 		push @{$c}, $_;
 	}
 	$c;
+}
+
+sub parse_routine_array {
+	my($item,$settings) = @_;
+
+	return '' unless $settings;
+
+	my $c;
+	if(defined $C) {
+		$c = $C->{$item};
+	}
+	else {
+		no strict 'refs';
+		$c = ${"Global::$item"};
+	}
+
+	my @mac;
+
+	if($settings =~ /^[-\s\w,]+$/) {
+		@mac = grep /\S/, split /[\s,]+/, $settings;
+	}
+	else {
+		push @mac, $settings;
+	}
+
+	if(ref($c) eq 'ARRAY') {
+		push @$c, @mac;
+	}
+	elsif($c) {
+		$c = [$c, @mac];
+	}
+	else {
+		$c = scalar(@mac) > 1 ? [ @mac ] : $mac[0];
+	}
+
+	return $c;
 }
 
 sub parse_array_complete {



1.50      +3 -9      interchange/lib/Vend/Dispatch.pm


rev 1.50, prev_rev 1.49
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Dispatch.pm	12 Apr 2005 15:14:39 -0000	1.49
+++ Dispatch.pm	17 Apr 2005 12:44:39 -0000	1.50
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.49 2005/04/12 15:14:39 mheins Exp $
+# $Id: Dispatch.pm,v 1.50 2005/04/17 12:44:39 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.49 $, 10);
+$VERSION = substr(q$Revision: 1.50 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -1542,13 +1542,7 @@
 #show_times("end page display") if $Global::ShowTimes;
 
 	if(my $macro = $Vend::Cfg->{AutoEnd}) {
-		if($macro =~ /\[\w+/) {
-			interpolate_html($macro);
-		}
-		elsif ($macro =~ /^\w+$/) {
-			$sub = $Vend::Cfg->{Sub}{$macro} || $Global::GlobalSub->{$macro};
-			$sub->();
-		}
+		run_macro($macro);
 #show_times("end AutoEnd macro") if $Global::ShowTimes;
 	}
   }








More information about the interchange-cvs mailing list