Commit | Line | Data |
0ba6e8aa |
1 | package Catalyst::Script::CGI; |
accb0640 |
2 | use Moose; |
0ba6e8aa |
3 | |
accb0640 |
4 | BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' } |
5 | use FindBin qw/$Bin/; |
6 | use lib "$Bin/../lib"; |
7 | use Pod::Usage; |
8 | use Moose; |
7f67b4a9 |
9 | use namespace::autoclean; |
accb0640 |
10 | |
11 | with 'MooseX::Getopt'; |
12 | |
8a289b5f |
13 | has _app => ( |
14 | reader => 'app', |
15 | init_arg => 'app', |
16 | traits => [qw(NoGetopt)], |
17 | isa => 'Str', |
18 | is => 'ro', |
19 | ); |
20 | |
21 | has help => ( |
22 | traits => [qw(Getopt)], |
23 | cmd_aliases => 'h', |
24 | isa => 'Bool', |
25 | is => 'ro', |
26 | documentation => qq{ display this help and exits }, |
27 | ); |
28 | |
accb0640 |
29 | |
30 | sub run { |
31 | my $self = shift; |
57dc50b0 |
32 | |
accb0640 |
33 | pod2usage() if $self->help; |
34 | my $app = $self->app; |
35 | Class::MOP::load_class($app); |
36 | $app->run; |
37 | |
38 | } |
0ba6e8aa |
39 | 1; |