On Thu, Sep 19, 2002 at 10:02:32AM +0200, David Samuelsson (PAC) wrote: > I want it so it will execute the subs in the order according to the lines > when i start the scrippt, and i will try to keep to default -value cause > the scipt will probably be used by others aswell so no double --.
You don't want to make other people use the '--' switches to use the script? Why not? Getopt::Long will probably accommodate you in this, but I would suggest reserving the single '-' for one-letter options, and the double '-' for long options. That way, the one-letter options can be bundled, e.g. -rh for --reg_backup and --html. Also, it might be more natural to use 'reg-backup', instead of 'reg_backup'. > when i run myscript.pl -reg_backup -html > > it should execute reg_backup sub first then the html sub. This can be accomplished by specifying a subroutine reference as your value, instead of a scalar reference. E.g. GetOptions( reg_backup => \®_backup, html => \&html, ); You mentioned in a previous message in this thread that reg_backup would setup an array, and html would process it. This would have to be accomplished by some shared variable; html() would have to verify the variable was setup correctly, and if not, do something to notify the user. See the "User-defined subroutines to handle options" section in perldoc Getopt::Long. I would suggest you read the entire perldoc for the module at least once, to get an idea of what it provides. > I plan to have an exit sub that will run if they havent put the switches > togheter right. It will be more commnd lines, so if they enter it wrong it > will die with an error. and off course there will be some command line > that will run almost all subs, but in the order i have specified. So when > they specify lets say -all switch it goes to $all here is an order off all > subs and the order it should run them in.. I don't completely understand what you're trying to describe here. Hopefully the advice I've already given will give you enough of a starting point to solve the problem yourself. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]