untarded and added documentation
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Script / CGI.pm
CommitLineData
0ba6e8aa 1package Catalyst::Script::CGI;
accb0640 2use Moose;
0ba6e8aa 3
accb0640 4BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' }
5use FindBin qw/$Bin/;
6use lib "$Bin/../lib";
7use Pod::Usage;
8use Moose;
4ebd5ecf 9use namespace::autoclean -except => [ qw(meta) ];
accb0640 10
11with 'MooseX::Getopt';
12
8a289b5f 13has _app => (
14 reader => 'app',
15 init_arg => 'app',
16 traits => [qw(NoGetopt)],
17 isa => 'Str',
18 is => 'ro',
19);
20
21has 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
30sub 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 391;