use strict; use warnings; package Getopt::Long::Spec; { $Getopt::Long::Spec::VERSION = '0.002'; } # ABSTRACT: translate Getopt::Long specs into a hash of attributes, and back again use Getopt::Long::Spec::Builder; use Getopt::Long::Spec::Parser; sub new { return bless {}, shift } sub parse { my $self = shift; return Getopt::Long::Spec::Parser->parse(@_); } sub build { my $self = shift; return Getopt::Long::Spec::Builder->build(@_); } 1 && q{ I do these things because, well, who's stopping me? }; # truth =pod =head1 NAME Getopt::Long::Spec - translate Getopt::Long specs into a hash of attributes, and back again =head1 VERSION version 0.002 =head1 SYNOPSIS use Getopt::Long::Spec; my $gls = Getopt::Long::Spec->new; my %attrs = $gls->parse('foo|f=i@{3,4}'); my $spec = $gls->build( long => 'foo', short => 'f', val_required => 1, val_type => 'int', dest_type => 'array', min_vals => 3, max_vals => 4, ); =head1 DESCRIPTION This dist provides a means of parsing L's option specifications and turning them into hashes describing the spec. Furthermore, it can do the inverse, turning a hash into an option spec! Care has been taken to ensure that the output of L can always be fed back into L to get the exact same spec - essentially round-tripping the spec passed to parse. I'm not yet sure it works the other way arround, that the hashes are round-tripped, but I am less concerned with that for no other reason than the fact that the code is already twisted enough as it is to ensure the former situation. :) =head1 METHODS =head2 new Simple constructor, takes no options. =head2 parse Given a valid L L