2 package MooseX::Getopt::Parser::Long;
6 with 'MooseX::Getopt::Parser';
9 my ($class, $opt_spec) = @_;
13 my $getopt = Getopt::Long::Parser->new;
14 $getopt->getoptions(\%options, @$opt_spec);
15 return ( \%options, undef );
18 sub _get_getopt_spec {
19 my ($class, %params) = @_;
21 my ( @options, %name_to_init_arg, %options );
23 foreach my $opt ( @{ $params{options} } ) {
24 push @options, $opt->{opt_string};
26 my $identifier = $opt->{name};
27 $identifier =~ s/\W/_/g; # Getopt::Long does this to all option names
29 $name_to_init_arg{$identifier} = $opt->{init_arg};
32 return ( \@options, \%name_to_init_arg );