[Chicago-talk] Is there a way to simplify including multiple .pm files?

He Guangsheng-W16844 Guangsheng.He at motorola.com
Sun Mar 16 17:29:33 PDT 2008

Thanks for all great replies. 

"TIMTOWTDI" - facts really speaks louder. 

Here is the background story to share, I am pretty sure you guys can
come up some better ideas.

I designed and coded one set of scripts for automating our platform
releasing. Right now it covers build request checking, building,
labeling, releasing, metrics generation, binaries building & releasing
as well as other misc. tasks, and now working on SDK releasing too. So
far it works perfectly, from historical reason, the scripts were started
when only one product was supported. Later on, more and more products
came, so I have to keep modify the config file. 

The users of these scripts have 0 or approx. 0 knowledge about Perl and
I don't want to 'waste' time on config changes. To release this burden,
I designed a constant .pm template and split the large config file to
small pieces, whenever a new product comes or any changes to an existing
product, the user needs to populate information to a new .pm file or
modify existing .pm file. The benefit to use one .pm file for one
product is, one user can screw up his own file only. Here comes the
problem I was asking, they need to add 'using ....' to each of the
scripts, which is really ugly to me.

The OO approach looks more straightforward to me, designing a class with
only one data members to hold all constants ...


-----Original Message-----
From: Randal L. Schwartz [mailto:merlyn at stonehenge.com] 
Sent: Friday, March 14, 2008 6:39 PM
To: He Guangsheng-W16844
Cc: chicago-talk at pm.org
Subject: Re: [Chicago-talk] Is there a way to simplify including
multiple .pm files?

>>>>> "He" == He Guangsheng-W16844 <Guangsheng.He at motorola.com> writes:

He> My scripts take a lot of constants, so I defined these constants in 
He> several ConstantVar.pm files and include them all.

This seems like a bad design to me.  Why would more than one or two
sections of your code need to know a bunch of constants?

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095 <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl

More information about the Chicago-talk mailing list