Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Wrap multiple programs

by stevieb (Canon)
on Mar 18, 2017 at 00:53 UTC ( [id://1185097]=note: print w/replies, xml ) Need Help??


in reply to Wrap multiple programs

You can not get command line options twice within the same program. I recommend writing both Plot and Calc into subroutines within the main script, and go from there.

Otherwise, create a module out of both of the mentioned "things" into modules, import them into your main script, then distribute the cli arguments appropriately.

Replies are listed 'Best First'.
Re^2: Wrap multiple programs
by haukex (Archbishop) on Mar 18, 2017 at 11:06 UTC

    To the OP: Although below I'll show a way to put multiple commands on one command line, I actually don't necessarily recommend this, nor would I recommend building a monolithic "one script to do it all", instead follow stevieb's and Athanasius's advice to modularize. One element of the Unix philosophy is to make each tool "Do One Thing and Do It Well". If your scripts need to share common functions, then do that through a module, rather than shoving all the code into one script.

    You can not get command line options twice within the same program.

    That statement is just a little too absolute for my tastes, it's totally possible to get too clever with @ARGV :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1185097]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-16 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found