Additional notes and cleanup
[catagits/Catalyst-Runtime.git] / lib / Catalyst / ScriptRole.pm
index 6bea8c1..f726626 100644 (file)
@@ -8,7 +8,7 @@ use MooseX::Types::LoadableClass qw/LoadableClass/;
 use namespace::autoclean;
 
 with 'MooseX::Getopt' => {
-    excludes => [qw/
+    -excludes => [qw/
         _getopt_spec_warnings
         _getopt_spec_exception
         _getopt_full_usage
@@ -22,14 +22,6 @@ has application_name => (
     required => 1,
 );
 
-has help => (
-    traits        => ['Getopt'],
-    isa           => Bool,
-    is            => 'ro',
-    documentation => 'Display this help and exit',
-    cmd_aliases   => ['?', 'h'],
-);
-
 has loader_class => (
     isa => LoadableClass,
     is => 'ro',
@@ -41,7 +33,8 @@ has loader_class => (
 has _loader => (
     isa => 'Plack::Loader',
     default => sub {
-        shift->loader_class->new
+        my $self = shift;
+        $self->loader_class->new(application_name => $self->application_name);
     },
     handles => {
         load_engine => 'load',
@@ -63,11 +56,6 @@ sub _getopt_full_usage {
     exit 0;
 }
 
-before run => sub {
-    my $self = shift;
-    $self->_getopt_full_usage if $self->help;
-};
-
 sub run {
     my $self = shift;
     $self->_run_application;
@@ -78,7 +66,8 @@ sub _application_args {
 }
 
 sub _plack_loader_args {
-    my @app_args = shift->_application_args;
+    my $self = shift;
+    my @app_args = $self->_application_args;
     return (port => $app_args[0]);
 }