perl - Getopt::Long
Is there anything better out there? I'm having some buggy behavior. Though it may just be my inexperience with it.
I'm experimenting with writting perl modules for Xchat...
> Bang Help Menu:
> Usage: /bang [OPTIONS] "COMMAND"
>
> If OPTIONS are used, the COMMAND must be in quotes.
> Quotes are optional if OPTIONS are not used.
>
> -e Echo mode (private output) [Default]
> -h, -? Help
> -p Print mode (public output)
> -v Display command executed
Mark Hensler
If there is no answer on Google, then there is no question.
Wil posted this at 11:22 — 17th May 2003.
They have: 601 posts
Joined: Nov 2001
What problems are you having with Getopt::long? It's a pretty sound module with a big user base, shouldn't think that there are many bugs left in it. What vrsion you running?
- wil
Mark Hensler posted this at 17:23 — 17th May 2003.
He has: 4,048 posts
Joined: Aug 2000
hmm..
I played with it a bit more, but I'm probably missing a configuration option.
use Getopt::Long;
Getopt::Long::Configure('auto_abbrev', 'bundling_override');
If I have any extra characters in the options, I get an error:
/bang -evg "fortune"
Unknown option: g "fortune"
Not a bad thing.
But if I have my command without being in quotes, I get the same error:
/bang -pv fortune
Unknown option: fortune
Now that I dont like. Is there anyway I can allow my commands to be without quotes?
Mark Hensler
If there is no answer on Google, then there is no question.
Wil posted this at 23:05 — 17th May 2003.
They have: 601 posts
Joined: Nov 2001
Hm, not sure as I haven't played with it. But my suggestion would be to write a quick hack that will 'quotify' your input before passing it onto Getopt::Long. I know it's a workaround but it could work?
- wil
Mark Hensler posted this at 23:12 — 17th May 2003.
He has: 4,048 posts
Joined: Aug 2000
Good idea. I'll try when I have time. Thanks.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.