> I have a constant.epl file that defines some variables [...]

[-
    $req = shift;
    $req->{website_database} = 'DBI:Sprite:/www/db/Annual_Review';
    $req->{website_event_table} = 'ar_events';
    $req->{website_sequence} = 'ar_num';
    $req->{db_user} = 'username';
    $req->{db_pass} = 'password';
-]

> I need to get at those definitions in a perl script outside the www
> environment and I'm not sure how to do it.  Is there a easy way to do
> this?


#! /usr/bin/perl

open(FH, "<constant.epl") || die $!;
my $var = do { local $/; <FH> };

# this works for the simple example block only
$var =~ s/\[\-(.*)\-\]/$1/s;

eval $var;
die $@ if $@;

# variables available now
print "$req->{db_user} \n"; # prints 'username'

tstock





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to