Commit | Line | Data |
ac2073c8 |
1 | |
2 | package MooseX::Getopt::Parser::Default; |
3 | |
4 | use Moose; |
5 | |
6 | use MooseX::Getopt::Parser::Long; |
7 | use maybe 'MooseX::Getopt::Parser::Descriptive'; |
8 | |
9 | |
10 | sub new { |
11 | my $class = shift; |
12 | return maybe::HAVE_MOOSEX_GETOPT_PARSER_DESCRIPTIVE |
13 | ? MooseX::Getopt::Parser::Descriptive->new(@_) |
14 | : MooseX::Getopt::Parser::Long->new(@_); |
15 | }; |
16 | |
17 | |
18 | 1; |
19 | |
20 | __END__ |
21 | |
22 | =pod |
23 | |
24 | =head1 NAME |
25 | |
26 | MooseX::Getopt::Parser::Default - A default parser for MooseX::Getopt |
27 | |
28 | =head1 SYNOPSIS |
29 | |
30 | use MooseX::Getopt::Parser::Default; |
31 | |
32 | my $parser = MooseX::Getopt::Parser::Default->new( config => ['pass_through'] ); |
33 | my $getopt = MooseX::Getopt::Session->new( parser => $parser ); |
34 | my $app = My::App->new( getopt => $getopt ); |
35 | |
36 | =head1 DESCRIPTION |
37 | |
38 | This class contains the factory method which returns new |
39 | L<MooseX::Getopt::Parser> object. The object's class is |
40 | L<MooseX::Getopt::Parser::Descriptive> if L<Getopt::Long::Descriptive> |
41 | module exists or L<MooseX::Getopt::Parser::Long> otherwise. |
42 | |
43 | =head1 METHODS |
44 | |
45 | =over 4 |
46 | |
47 | =item B<new (%params)> |
48 | |
49 | This is the factory method which returns new L<MooseX::Getopt::Parser> |
50 | object. All C<%params> are passed to new object. |
51 | |
52 | =back |
53 | |
54 | =head1 BUGS |
55 | |
56 | All complex software has bugs lurking in it, and this module is no |
57 | exception. If you find a bug please either email me, or add the bug |
58 | to cpan-RT. |
59 | |
60 | =head1 SEE ALSO |
61 | |
62 | =over 4 |
63 | |
64 | =item L<MooseX::Getopt::Parser> |
65 | |
66 | =item L<MooseX::Getopt::Parser::Long> |
67 | |
68 | =item L<MooseX::Getopt::Parser::Descriptive> |
69 | |
70 | =back |
71 | |
72 | =head1 AUTHOR |
73 | |
74 | Piotr Roszatycki, E<lt>dexter@cpan.orgE<gt> |
75 | |
76 | =head1 COPYRIGHT AND LICENSE |
77 | |
78 | Copyright 2007-2008 by Infinity Interactive, Inc. |
79 | |
80 | L<http://www.iinteractive.com> |
81 | |
82 | This library is free software; you can redistribute it and/or modify |
83 | it under the same terms as Perl itself. |
84 | |
85 | =cut |