#include for Perl?

John Evans jtevans at kilnar.com
Tue Oct 15 00:02:03 CDT 2002


Hey guys,

	I'm writing a set of Perl scripts that share a common set of
configuration variables. When one variable changes, I would like to change
one file and have all scripts recognize the change. Somethign akin to what
"#include" does for C.

I've been doing things along the lines of:

File: config.inc
$docpath = "/home/jtevans/doc";
$binpath = "/home/jtevans/bin";
$data = "/home/jtevans/report/data.txt";
# more vars ....


File: find_bad_fields.plo
#!/usr/local/bin/perl -wT

use "./config.inc";
# Also tried eval and require.

open(DATAIN, $data) or die("Aaahh!!!\n");
while (<DATAIN>) {
# do stuff...
}
close(DATAIN);


Is there a way to do what I'm trying or am I SOL?

Thanks in advance for any advice you guys can pass my way...

-- 
John Evans
http://jtevans.kilnar.com/

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s++:- a- C+++>++++ ULSB++++$ P+++$ L++++$
E--- W++ N+ o? K? w O- M V PS+ !PE Y+ PGP t(--) 5-- X++(+++)
R+++ tv+ b+++(++++) DI+++ D++>+++ G+ e h--- r+++ y+++
------END GEEK CODE BLOCK------





More information about the Pikes-peak-pm mailing list