in reply to Getopt::Long

I think this is what you're hinting at ( i can't be sure ):
use Getopt::Long; use Data::Dumper; my %menu; my @root = ( \%menu, qw[add! remove! die! warn!] ); PROMPT: print "what u want(add remove die warn)?: "; while(<>){ chomp; $_ = "-$_" unless /^-/; # fake it local @ARGV = $_; undef %menu; if(GetOptions( @root )){ print "\n\n", Dumper \%menu; if(exists $menu{add}) { print "\n\nadding\n\n"; } elsif(exists $menu{remove}) { print "\n\nremoving\n\n"; } elsif(exists $menu{warn}) { warn "\n\nwarning\n\n"; } elsif(exists $menu{die}) { die "\n\ndying!\n\n"; } }else{ warn "\n\nerror parsing options [$!][$@]\n\n"; } goto PROMPT; } __END__
Alternatively, i'd either use http://search.cpan.org/author/PRL/Term-Interact-0.44/Interact.pm
or
http://search.cpan.org/author/EVO/Term-ShellKit-1.002/
to develop this, possibly incorporating
http://search.cpan.org/author/DROLSKY/Params-Validate-0.24/
or
http://search.cpan.org/author/ABIGAIL/Regexp-Common-1.20/
to do validation.

Also, i'd check out the Getopt distributions and see if any of the modules listed suit your needs.


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re: Re: Getopt::Long
by hotshot (Prior) on Dec 16, 2002 at 12:00 UTC
    now your talking, I guess I wasn't clear enough at the begining. Thanks a lot, it seems like a good starting point for me I'll check also the URLs you mentioned.

    and again, thanks.

    Hotshot