The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Util::Getopt::Menu - An easy-to-print CLI menu for Getopt

VERSION

This documentation describes version 0.01

SYNOPSIS

use Util::Getopt::Menu;
use Getopt::Long;

my %o = ( s => 30, link => 'current' );

my $menu = Util::Getopt::Menu->new
(
    'h|help',"print help menu",
    's|sleep=i',"[ $o{s} ] seconds between iterations",
    'link=s',"[ $o{link} ] symlink to current config",
    'server=s','server host:port',
);

my @option = $menu->option();
my $string = $menu->string();

die join "\n", "Usage:\tdefault value in [ ]", $string, "\n"
    unless Getopt::Long::GetOptions( \%o, @option ) && ! $o{h};

option()

Returns menu options as a list. Returns ARRAY reference in scalar context.

string()

Serializes menu.

AUTHOR

Kan Liu

COPYRIGHT and LICENSE

Copyright (c) 2010. Kan Liu

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.