add a synopsis
[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
5ffe2079 28=head1 SYNOPSIS
29
30 package My::App;
31 use Moose;
32 with 'MooseX::Getopt::Dashes';
33
34 # use as MooseX::Getopt
35
5f78e881 36=head1 DESCRIPTION
37
38This is a version of C<MooseX::Getopt> which converts underscores in
39attribute names to dashes when generating command line flags.
40
41=head1 METHODS
42
43=over 4
44
45=item meta
46
47=back
48
49=head1 BUGS
50
51All complex software has bugs lurking in it, and this module is no
52exception. If you find a bug please either email me, or add the bug
53to cpan-RT.
54
55=head1 AUTHOR
56
57Dagfinn Ilmari MannsE<aring>ker E<lt>ilmari@ilmari.orgE<gt>
58
59Stevan Little E<lt>stevan@iinteractive.comE<gt>
60
61Yuval Kogman C<< <nuffin@cpan.org> >>
62
63=head1 COPYRIGHT AND LICENSE
64
65Copyright 2007-2008 by Infinity Interactive, Inc.
66
67L<http://www.iinteractive.com>
68
69This library is free software; you can redistribute it and/or modify
70it under the same terms as Perl itself.
71
72=cut