beast schreef:

> I just want to load variable from config file:
>
> config.pl:
> $basedir = '/home/user/';
>
> myprog.pl:
> #use strict;
> do 'config.pl' or die "can not open config\n";
> # do some stuff here
>
> the problem is, i have to disable strict in myprog.pl. any other way
> to do it? Thanks.

If the config.pl contains only basic variable settings, I would change
it to a non-code variant, like ini, and then read the contents into a
hash.

Consider Config::General which supports multi-level configs like

    # main.cfg
    <object billy>
        class=Some::Class
        <printers>
            include printers.cfg
        </printers>
        # ...
    </object>
    <object bob>
        class=Another::Class
        <printers>
            include printers.cfg
        </printers>
        # ...
    </object>


-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to