X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FScript%2FCGI.pm;h=4608a7cd30c73f46e7102b753c6bc3d46e46b3b9;hb=7f67b4a91471d952f5f52a216c85a1bd061f6f7c;hp=bdbf15cd97932f5e4fb9dc98c2ff5846bf2a90cd;hpb=0ba6e8aaafec7621c9444f470a849bd161f176e0;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Script/CGI.pm b/lib/Catalyst/Script/CGI.pm index bdbf15c..4608a7c 100644 --- a/lib/Catalyst/Script/CGI.pm +++ b/lib/Catalyst/Script/CGI.pm @@ -1,3 +1,39 @@ package Catalyst::Script::CGI; +use Moose; +BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' } +use FindBin qw/$Bin/; +use lib "$Bin/../lib"; +use Pod::Usage; +use Moose; +use namespace::autoclean; + +with 'MooseX::Getopt'; + +has _app => ( + reader => 'app', + init_arg => 'app', + traits => [qw(NoGetopt)], + isa => 'Str', + is => 'ro', +); + +has help => ( + traits => [qw(Getopt)], + cmd_aliases => 'h', + isa => 'Bool', + is => 'ro', + documentation => qq{ display this help and exits }, +); + + +sub run { + my $self = shift; + + pod2usage() if $self->help; + my $app = $self->app; + Class::MOP::load_class($app); + $app->run; + +} 1;