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