We don't bite newbies here... much | |
PerlMonks |
Re: alternative way to subsby Codon (Friar) |
on Apr 30, 2008 at 16:55 UTC ( [id://683725]=note: print w/replies, xml ) | Need Help?? |
Taking the idea behind Corion's code, but working on how to do this without needing to modify the individual scripts, I came up with the idea of wrapping the code of each script into a subroutine in your General.pl.
I've banged together a script that works (for some definition), but I'm sure could run afoul if you aren't careful or if your needs are not quite the same as the assumptions I made.
I happen to have several scripts in my directory (1.pl, 2.pl, 3.pl, etc.) because I use them for writing test / proof of concept code. This works in that it wraps each file in a subroutine; it calls each subroutine; the work is done; output is returned as expected and errors are trapped and handled. This requires no modification to the existing scripts. If you need to pass arguments to the scripts, they can be passed to the subourtines and all is rosey.
Ivan Heffner Sr. Software Engineer WhitePages.com, Inc.
In Section
Seekers of Perl Wisdom
|
|