Ezilon.com - Target Your Audience, be Seen in Your Region

perl - Getopt::Long

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
Mark Hensler's picture

He has: 4,044 posts

Joined: Aug 2000

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 ["Max Albert"] [Email]
If there is no answer on Google, then there is no question.

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's picture

He has: 4,044 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 ["Max Albert"] [Email]
If there is no answer on Google, then there is no question.

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's picture

He has: 4,044 posts

Joined: Aug 2000

Good idea. I'll try when I have time. Thanks.