add MooseX::Getopt::Dashes
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / Dashes.pm
CommitLineData
5f78e881 1package MooseX::Getopt::Dashes;
2use Moose::Role;
3
4with 'MooseX::Getopt';
5
6around _get_cmd_flags_for_attr => sub {
7 my $next = shift;
8 my ( $class, $attr, @rest ) = @_;
9
10 my ( $flag, @aliases ) = $class->$next($attr, @rest);
11 $flag =~ tr/_/-/
12 unless $attr->does('MooseX::Getopt::Meta::Attribute::Trait')
13 && $attr->has_cmd_flag;
14
15 return ( $flag, @aliases );
16};
17
181;
19
20__END__
21
22=pod
23
24=head1 NAME
25
26MooseX::Getopt::Dashes - convert underscores in attribute names to dashes
27
28=head1 DESCRIPTION
29
30This is a version of C<MooseX::Getopt> which converts underscores in
31attribute names to dashes when generating command line flags.
32
33=head1 METHODS
34
35=over 4
36
37=item meta
38
39=back
40
41=head1 BUGS
42
43All complex software has bugs lurking in it, and this module is no
44exception. If you find a bug please either email me, or add the bug
45to cpan-RT.
46
47=head1 AUTHOR
48
49Dagfinn Ilmari MannsE<aring>ker E<lt>ilmari@ilmari.orgE<gt>
50
51Stevan Little E<lt>stevan@iinteractive.comE<gt>
52
53Yuval Kogman C<< <nuffin@cpan.org> >>
54
55=head1 COPYRIGHT AND LICENSE
56
57Copyright 2007-2008 by Infinity Interactive, Inc.
58
59L<http://www.iinteractive.com>
60
61This library is free software; you can redistribute it and/or modify
62it under the same terms as Perl itself.
63
64=cut