1 package Catalyst::ScriptRole;
3 use MooseX::Types::Moose qw/Str Bool/;
6 use namespace::autoclean;
8 with 'MooseX::Getopt' => {
11 _getopt_spec_exception
16 has application_name => (
17 traits => ['NoGetopt'],
27 documentation => 'Display this help and exit',
28 cmd_aliases => ['?', 'h'],
31 sub _getopt_spec_exception {}
33 sub _getopt_spec_warnings {
38 sub _getopt_full_usage {
46 $self->_getopt_full_usage if $self->help;
51 $self->_run_application;
54 sub _application_args {
58 sub _run_application {
60 my $app = $self->application_name;
61 Class::MOP::load_class($app);
62 $app->run($self->_application_args);
69 Catalyst::ScriptRole - Common functionality for Catalyst scripts.
73 package MyApp::Script::Foo;
75 use namespace::autoclean;
77 with 'Catalyst::ScriptRole';
79 sub _application_args { ... }
83 Role with the common functionality of Catalyst scripts.
89 The method invoked to run the application.
93 =head2 application_name
95 The name of the application class, e.g. MyApp
105 Catalyst Contributors, see Catalyst.pm
109 This library is free software, you can redistribute it and/or modify
110 it under the same terms as Perl itself.