X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Getopt.git;a=blobdiff_plain;f=lib%2FMooseX%2FGetopt%2FDashes.pm;fp=lib%2FMooseX%2FGetopt%2FDashes.pm;h=ffad5991bd2a3955f2ac10abea5cc07a36051dab;hp=0000000000000000000000000000000000000000;hb=5f78e8817a86a1178b4880d40da6cc2027c78a7a;hpb=091954ece6d3e231cfa0529d9a8b943282b0fe45 diff --git a/lib/MooseX/Getopt/Dashes.pm b/lib/MooseX/Getopt/Dashes.pm new file mode 100644 index 0000000..ffad599 --- /dev/null +++ b/lib/MooseX/Getopt/Dashes.pm @@ -0,0 +1,64 @@ +package MooseX::Getopt::Dashes; +use Moose::Role; + +with 'MooseX::Getopt'; + +around _get_cmd_flags_for_attr => sub { + my $next = shift; + my ( $class, $attr, @rest ) = @_; + + my ( $flag, @aliases ) = $class->$next($attr, @rest); + $flag =~ tr/_/-/ + unless $attr->does('MooseX::Getopt::Meta::Attribute::Trait') + && $attr->has_cmd_flag; + + return ( $flag, @aliases ); +}; + +1; + +__END__ + +=pod + +=head1 NAME + +MooseX::Getopt::Dashes - convert underscores in attribute names to dashes + +=head1 DESCRIPTION + +This is a version of C which converts underscores in +attribute names to dashes when generating command line flags. + +=head1 METHODS + +=over 4 + +=item meta + +=back + +=head1 BUGS + +All complex software has bugs lurking in it, and this module is no +exception. If you find a bug please either email me, or add the bug +to cpan-RT. + +=head1 AUTHOR + +Dagfinn Ilmari MannsEker Eilmari@ilmari.orgE + +Stevan Little Estevan@iinteractive.comE + +Yuval Kogman C<< >> + +=head1 COPYRIGHT AND LICENSE + +Copyright 2007-2008 by Infinity Interactive, Inc. + +L + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut