> Thanks, Ram.  I was rather hoping there was something simpler than fully-fledged 
> modules.
> 
> Basically what I've done is set up a single script and a bunch of config files.
> Each config file ends in 
> 
> #%include bin/script.pl
> 
> And I use a minimalist PerlPP to include it.  This is so I can use
> full perl syntax for the config files.
> 
> You can have a look if you like: sf.net/projects/autocomic
> (get the tarball, it's newer than cvs)
> 
> I guess I'll give modules a try at the next coding iteration.
> 
> -trent
> 
> PS: Incidentally, I think source() should be added to the language.


Well no. source() may be great to just get some parameters from a config
file in a small project.

But learn from my experience , projects grow with time. Then managing
variables without namespace , especially when it has been long since you
have seen the code becomes a nightmare

let us take an example
Suppose Now I have a project that shows pages on stocks.
I define a stocks.cfg configuration file and define "PAGESIZE=15" ( in
bash )
I source the config file in my shell script 
everything works fine

Two months down the line my boss asks my junior  to add a page on sports
in the same script.
He writes the file sources sports.cfg ( above stocks.cfg ) containing
PAGESIZE=100
and he never figures out why his pagesize is always 15 

Suppose I could use my variable like $stocks::PAGESIZE then this would
never occur
Thats precisely what you should do with namespaces.

Not that you cannot do what you want in perl 

just put  a variable with ::
$::PAGESIZE=15; 
1;
in a file ( say Config.pm ) 

and source the file with 
require "/path/Config.pm";

Thats' it  So simple ,there may be a hundred more ways. But stay away
from it.

Ram










----------------------------------------------------------------

NETCORE SOLUTIONS *** Ph: +91 22 5662 8000 Fax: +91 22 5662 8134

MailServ and FlexiMail: Messaging Solutions: http://netcore.co.in

Pragatee: Integrated Server-Software Suite: http://www.pragatee.com

Emergic Freedom: Server-centric Computing: http://www.emergic.com

BlogStreet: Blog Profiles and RSS Ecosystem: http://blogstreet.com

Deeshaa: Rural Development: http://www.deeshaa.com

Rajesh Jain's Weblog on Technology: http://www.emergic.org
----------------------------------------------------------------

Reply via email to