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'],
23 sub _getopt_spec_exception {}
25 sub _getopt_spec_warnings {
30 sub _getopt_full_usage {
38 $self->_run_application;
41 sub _application_args {
45 sub _run_application {
47 my $app = $self->application_name;
48 Class::MOP::load_class($app);
49 $app->run($self->_application_args);
56 Catalyst::ScriptRole - Common functionality for Catalyst scripts.
60 package MyApp::Script::Foo;
62 use namespace::autoclean;
64 with 'Catalyst::ScriptRole';
66 sub _application_args { ... }
70 Role with the common functionality of Catalyst scripts.
76 The method invoked to run the application.
80 =head2 application_name
82 The name of the application class, e.g. MyApp
92 Catalyst Contributors, see Catalyst.pm
96 This library is free software, you can redistribute it and/or modify
97 it under the same terms as Perl itself.