Getopt::Fancy

Getopt::Fancy is an object approach to handling command line options, focusing on end user happiness.
Download

Getopt::Fancy Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Robert Powers
  • Publisher web site:
  • http://search.cpan.org/~batman/

Getopt::Fancy Tags


Getopt::Fancy Description

Getopt::Fancy is an object approach to handling command line options, focusing on end user happiness. Getopt::Fancy is an object approach to handling command line options, focusing on end user happiness.SYNOPSIS use Getopt::Fancy; my $opts = Getopt::Fancy->new(); $opts->add("db", GT => "=s", EX => "", DESC => "The database to dump. Leave unset for all databases.", DEF => "teen_titans", ALLOWED => , REGEX => '^+$', REQ => 0, SECTION => "Required DB Params"); # Allow just printing out of set options $opts->add("check_args", DESC => "Just print all the options", SECTION => "Misc Params"); # Allow user to specify list of options s/he needs help with $opts->add("help", GT => ":s@", EX => "", DESC => "Give option names and it'll print the help for just those options, otherwise all.", SECTION=>"Misc Params", COMMAS=>1); # Get the command line options my $error_msg = $opts->get_options(); print_usage($error_msg) if $error_msg; print "Will dump this database: $opts->{db} n"; print "User wants help information on these: " . join(", ", @{$opts->{help}}) . "n" if ($opts->{help}); print_usage() if $opts->{help}; print_args() if $opts->{check_args}; sub print_args { print $opts->get_values(); exit(0); } sub print_usage { my $hopts; my $msg = shift; $hopts = $opts->{help} unless (scalar @{$opts->{help}} == 0); print "usage: $0 n"; print $opts->get_usage($hopts); print "ERROR: $msgn" if $msg; exit(0); }Getopt::Fancy Allows command line options to be all in one place in your script including default values, allowed values, user-friendly descriptions, required flags and pattern matching requirements. Ofttimes script writers skimp on the usage information or have out-dated help information. This modules helps script writers to be better citizens.This module uses Getopt::Long, so the same rules apply.Requirements:· Perl Requirements: · Perl


Getopt::Fancy Related Software