You could use the module that I am trying to use but having problems:
"AppConfig"

or you could use this (it works but is to limited for what I need):

#/usr/bin/perl

my $file = "/dir/somefile.txt";
open (CONFIG, "< $file") or die "Can't open $file";
while (<CONFIG>) {
       chomp;                  #no newline
       s/#.*//;                #no comments
       s/^\s+//;               #no leading white
       s/\s+$//;               #no trailing white
       next unless length;     #anything left?
       my ($var, $value) = split(/\s*=\s*/, $_, 2);
       $config{$var} = $value;
}
close(CONFIG);

#then print everything or a specific $var 
exit;

That should do the trick for you, if you have any luck see my positing
on AppConfig. AppConfig is used to do the same thing plus it has a lot
more features in it, I just can't get the damn thing to work. If this
works for you and you have a spare minute I would appreciate any help
that I could get on the AppConfig (two brains are better than one). If
you don't have time, don't worry about it.

jeffl


On Fri, 2002-02-01 at 09:13, gross, cedric wrote:
> I have a set of program to do which is using always same var.
>  
> So I would like to defined a small file where I defined my var (like
> $database="toto" $host="localhost" etc..) and then include it in my
> other program, but
> How to do that ?
>  
> I try "use" but it's seems that is for complete module.
> "require" seems to be for version behavior
> and include seems not be supported...
>  
> I browse doc but I found nothing..
>  
>  



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

Reply via email to