[Za-pm] Require and <>

Tielman de Villiers tvilliers at lastminute.com
Fri May 30 12:06:55 PDT 2008


On 2008-05-30 16:49, "Ian Balchin" <aesop at fables.co.za> wrote:

> Having got a number of routines to massage my data I thought that I should
> get them all together into one.
> 
> First thought, that I would sew them all up together in one giant script.
> Since 
> I have several divergent paths and would have several of 'mega-scripts', I
> could end up with a maintenance problem if I decided to change one of the
> component scripts which I would have to do within each mega-script. Not a
> big deal, but ...
> 
> Second thought, 'call' all of them from within the mega-script. I look at the
> camel book and decide that 'require' is the way to go. Well, yes and no
> because the scripts rely on command line file input which goes to <> and it
> looks like this does not retain the input for all the scripts called one after
> the 
> other. Any way, my simple effort generated error messages which I can't
> repeat  at this moment.
> 
> I may be wrong. However, my thought was then to save <> to a $myfiles at
> the beginning and then reset prior to calling each succeeding script. I
> haven't 
> actually tried this yet. So, question.
> 
> Is there a more elegant way of handling this small problem?
> 

Create modules and use "use" ?

http://perldoc.perl.org/perlmod.html#Perl-Modules

--tielman





More information about the Za-pm mailing list