Andrew F. Hampe
and 1 contributors

NAME

Wetware::CLI - A base class wrapper on Getopt::Long::GetOptions()

SYNOPSIS

    use Wetware::CLI;

    my $cli = Wetware::CLI->new();
    my $options_hash = $cli->get_options();

DESCRIPTION

I looked around, and there is no simple wrapper on GetOptions().

So rather than have to keep cutting and pasting the same basic set of semi private methods. I have opted to create a CLI Object, that will do all of the work for me.

I will discuss the question of subclassing later on.

The list of Semi Private Methods explain basically how to make your own CLI sub class.

METHODS

new()

Takes no arguments, and creates a simple blessed has.

get_options()

This wraps the Getopt::Long function.

SEMI_PRIVATE_METHODS

If you are not planning to subclass this, do not worry about this.

help_or_pod($options_hash)

If the help or pod option is set, then this will invoke the appropriate pod2usage() command.

option_defaults()

Returns the hash reference of option defaults. As implemented this is an empty hash reference.

option_specifications()

Returns the list of option specificans. As implemented this is merely the list help, pod, verbose.

remaining_argv($opts, @argv)

This is called after the help_or_pod(). As implemented this will add the 'remaining_argv' attributes to the $opts hash ref, if @ARGV is not empty.

This should be overridden if the sub class will want to have a named value.

It returns self, if there were any remaining values. Otherwise it returns undef.

required_settings()

returns the list of required settings.

verify_required_options($options_hash)

Check that all of the required options are set.

AUTHOR

"drieux", <"drieux [AT] at wetware.com">

BUGS

Please report any bugs or feature requests to bug-wetware-cli at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Wetware-CLI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

Getopt::Long;

use Pod::Usage;

SUPPORT

At present I do not have any support solutions.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 "drieux", all rights reserved.

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