Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Getopt::Fancy 0.02

    Download button

    No screenshots available
    Downloads: 345  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Robert Powers | More programs
    Perl Artistic License / FREE
    November 4th, 2006, 08:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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 => ["--all-databases", "mydb", "teen_titans"],
    REGEX => '^[a-zA-Z0-9_]+$',
    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 => "[option1,option2..]",
    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



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    handling command line options | object approach | Perl module | Getopt::Fancy | handling | command-line

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM