[interchange-cvs] interchange - heins modified scripts/interchange.PL
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Thu Aug 1 15:04:01 2002
User: heins
Date: 2002-08-01 19:03:45 GMT
Modified: scripts interchange.PL
Log:
* Add ability to require modules at runtime so that syntax errors in
Payment and Accounting modules can be detected up front without hacking
the code.
Revision Changes Path
2.47 +24 -1 interchange/scripts/interchange.PL
rev 2.47, prev_rev 2.46
Index: interchange.PL
=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/scripts/interchange.PL,v
retrieving revision 2.46
retrieving revision 2.47
diff -u -r2.46 -r2.47
--- interchange.PL 1 Aug 2002 18:51:10 -0000 2.46
+++ interchange.PL 1 Aug 2002 19:03:43 -0000 2.47
@@ -3,7 +3,7 @@
#
# Interchange version 4.9.2
#
-# $Id: interchange.PL,v 2.46 2002/08/01 18:51:10 mheins Exp $
+# $Id: interchange.PL,v 2.47 2002/08/01 19:03:43 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. and others.
# http://www.icdevgroup.org/
@@ -272,6 +272,29 @@
use Vend::Interpolate;
use Vend::Page;
use Vend::CounterFile;
+
+if($ENV{INTERCHANGE_REQUIRE}) {
+ my @mods =3D split /[;\s]+/, $ENV{INTERCHANGE_REQUIRE};
+ foreach my $mod (@mods) {
+ eval {
+ eval "require $mod";
+ die $@ if $@;
+ };
+ if($@) {
+ die errmsg(
+ "FAILED to require module %s as specified in environment. Error: %s\n"=
,=20
+ $mod,
+ $@,
+ );
+ }
+ else {
+ warn errmsg(
+ "Required module %s successfully as specified in environment.\n",=20
+ $mod,
+ );
+ }
+ }
+}
=20
if( ! $Global::Windows and $> =3D=3D -1 || scalar(getpwuid($>)) eq 'nobody=
' ) {
warn errmsg("\aYou probably don't want to run as nobody!\n");