1 package Catalyst::ScriptRole;
4 use MooseX::Types::Moose qw/Str Bool/;
7 use namespace::autoclean;
9 with 'MooseX::Getopt' => {
12 _getopt_spec_exception
17 has application_name => (
18 traits => ['NoGetopt'],
28 documentation => 'Display this help and exit',
29 cmd_aliases => ['?', 'h'],
32 sub _getopt_spec_exception {}
34 sub _getopt_spec_warnings {
39 sub _getopt_full_usage {
47 $self->_getopt_full_usage if $self->help;
52 $self->_run_application;
55 sub _application_args {
59 sub _run_application {
61 my $app = $self->application_name;
62 Class::MOP::load_class($app);
63 $app->run($self->_application_args);
70 Catalyst::ScriptRole - Common functionality for Catalyst scripts.
74 package MyApp::Script::Foo;
76 use namespace::autoclean;
78 with 'Catalyst::ScriptRole';
80 sub _application_args { ... }
84 Role with the common functionality of Catalyst scripts.
90 The method invoked to run the application.
94 =head2 application_name
96 The name of the application class, e.g. MyApp
106 Catalyst Contributors, see Catalyst.pm
110 This library is free software, you can redistribute it and/or modify
111 it under the same terms as Perl itself.