Main > Programming > Libraries >

Getopt::Popt 0.02

Getopt::Popt 0.02

Sponsored Links

Getopt::Popt 0.02 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.021 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 969
Date added: 2007-03-07
Publisher: James Baker

Getopt::Popt 0.02 description

Getopt::Popt is a Perl interface to the popt(3) library.

SYNOPSIS

use Getopt::Popt qw(:all);

# setup the options array
push @options,new Getopt::Popt::Option(
longName => "long",
shortName => "l",
argInfo => POPT_ARG_STRING,
arg => $qux,
val => $val);

# or, if youre lazy, have Getopt::Popt automagically do the new()
push @options, { shortName => s,
argInfo => POPT_ARG_NONE,
arg => $quux,
val => s
};

# "val"s can be a single character or an integer:
push @options, { longName => xor,
argInfo => POPT_ARG_VAL | POPT_ARGFLAG_XOR,
arg => $quuux,
val => 0xbadf00d # integer
},
Enable automatic help/usage messages (--help or --usage):
push @options, POPT_AUTOHELP;
Create a new popt context:
$popt = new Getopt::Popt(name => $alias_name,
argv => @ARGV,
options => @options,
flags => $flags);
Setup option aliases:
# load some aliases
$popt->readDefaultConfig();
$popt->readConfigFile("/path/to/aliases");

# add your own alias
$alias = new Getopt::Popt::Alias(longName => "taco",
argv => [qw(--flavored --kisses)]);
$popt->addAlias($alias, $alias_flags);
Load options as you would in C:
# loop through the options, using the popt C way:
while(($rc = $popt->getNextOpt()) > 0) {
...
# one way to get the arg val
$bork = $popt->getOptArg();
...
# stuff some args
$popt->stuffArgs(qw(-q -u -x));
...
# start over
$popt->resetContext();
...
}
And handle errors as you would in C:
$errstr = $popt->strerror($rc);
$badopt = $popt->badOption($rc,$badopt_flags);
Or try the new perly way:
eval {
while(defined($val = $popt->getNextOptChar())) {
^^^^-- note!
# $val is a Scalar::Util::dualvar:
if($val eq "c") { # <- character
...
} elsif($val == 0xbeef) { # <- integer
...
} elsif(ord($val) == 2922) { # <- utf8, ok!
...
}
...
# you can still stuff args or reset the context as before
...
}
};
# check for errors:
if($@) {
# prints something like "bad argument: --shoes: unknown option"
print "bad argument: $@n";
}
Get leftover args:
$arg = $popt->peekArg();
$arg = $popt->getArg();
@args = $popt->getArgs();

Getopt::Popt 0.02 Screenshot

Advertisements

Getopt::Popt 0.02 Keywords

Bookmark Getopt::Popt 0.02

Hyperlink code:
Link for forum:

Getopt::Popt 0.02 Copyright

WareSeeker periodically updates pricing and software information of Getopt::Popt 0.02 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Getopt::Popt 0.02 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Guile is a Perl interface to the Guile Scheme interpreter. Free Download
Net::Akismet is a Perl interface to Akismet - comment and trackback spam fighter. Free Download
Geo::Coder::Yahoo is a Perl module with geocode addresses with the Yahoo! API. Free Download
stat4proftpd is a Perl script (with console interface) that shows statistics. Free Download
GnuPG is a Perl module interface to the GNU Privacy Guard. Free Download
PGPLOT::Simple is a simple Perl Interface to PGPLOT. Free Download
Audio::DSP is a Perl interface to *NIX digital audio device. Free Download
Video::Xine is a Perl interface to libxine. Free Download