Just another Perl shrine | |
PerlMonks |
Re: Wrap multiple programsby Athanasius (Archbishop) |
on Mar 18, 2017 at 06:43 UTC ( [id://1185130]=note: print w/replies, xml ) | Need Help?? |
Hello jnarayan81, We can solve any problem by introducing an extra level of indirection. — the fundamental theorem of software engineering You can achieve your stated goal by adding a suitable command-line option and refactoring accordingly:
But, really, this is a bad idea. It won’t scale well, and in any case, what does it gain? It’s actually easier for a user to enter:
than
and by keeping the scripts separate, you avoid the complications that arise from having overlapping options. (For example, what if you want the --length option to default to 10 when plotting but to 20 when calculating? Then you would need to have separate options:
This could get messy very quickly.) So, it’s best to follow stevieb’s advice and modularise your code as much as possible. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|