
-----------------------------------
DtY
Sat Jun 06, 2009 7:29 pm

Quick Argument Parsing
-----------------------------------
Well, I'm sure there are huge libraries that do this, and make documentation for you and all that, but here's my quick one:
args = 
To use it, make a hash called $prefs holding the default values for all your preferences. When the program is run, it goes through each argument and if it starts with "--" then it checks if that key is in prefs, if it is it changes the value with the part after = (or true if they give nothing after), or else it dies telling the user that that is an invalid option. If it doesn't start with "--", it is pushed onto args. args now contains all your unnamed arguments, and prefs the named ones.

-----------------------------------
wtd
Sat Jun 06, 2009 11:42 pm

RE:Quick Argument Parsing
-----------------------------------
args = 
