Michael Kroher > Options-Generator > Options::Generator

Download:
Options-Generator-01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Options::Generator - Build options for the command line from a perl data structure

VERSION ^

Version 0.01

SYNOPSIS ^

    use Options::Generator;

    my $og = Options::Generator->new;
    print $og->generate($data);
 

    or more detailed...
     
    my $og = Options::Generater->new({
        outer_prefix   => [ '-', '--' ],
        outer_assign   => ' ',  # default
        outer_separate => ' ',  # default
        inner_assign   => '=',  # default
        inner_separate => ',',  # default
        ... 
    });
    my $data = {
        foo => 'bar',
        o =>  undef,
        s =>  'silly',
        options => [ 'one', 'two', { this => that }],
        blah => undef,
    };
    
    prints:

    --foo bar --options one,two,this=that, --blah -o -s silly

SUBROUTINES/METHODS ^

Options:Generator->new($args);

Accepts a hashref of definitions

$og->generate($data)

Returns a string of your options. Supply your perl data structure as a hash ref.

    my $data = {
        foo => 'bar',
        bar => 'baz',
        inner => [ 'this', 'that', { one => 'two'} ],
        a => b
        c => undef,
    };
    print $og->generate($hash);

AUTHOR ^

Michael Kroher, <infrared at cpan.org>

BUGS ^

Wrote this module for kvm-qemu generation stuff (hence the defaults).

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

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Options::Generator

You can also look for information at:

ACKNOWLEDGEMENTS ^

LICENSE AND COPYRIGHT ^

Copyright 2011 Michael Kroher.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: