Commit | Line | Data |
291722a8 |
1 | package Catalyst::ScriptRunner; |
2 | use Moose; |
d3082fac |
3 | use namespace::autoclean; |
291722a8 |
4 | |
cc999ce2 |
5 | sub run { |
6 | my ($self, $class, $scriptclass) = @_; |
c1c59374 |
7 | my $classtoload = "${class}::Script::$scriptclass"; |
8 | |
9 | # FIXME - Error handling / reporting |
10 | if ( eval { Class::MOP::load_class($classtoload) } ) { |
d3082fac |
11 | } |
12 | else { |
d24d92d9 |
13 | $classtoload = "Catalyst::Script::$scriptclass"; |
c1c59374 |
14 | Class::MOP::load_class($classtoload); |
d24d92d9 |
15 | } |
ab7eb5a9 |
16 | $classtoload->new_with_options( application_name => $class )->run; |
cc999ce2 |
17 | } |
d3082fac |
18 | |
19 | __PACKAGE__->meta->make_immutable; |
20 | |
21 | =head1 NAME |
22 | |
23 | Catalyst::ScriptRunner - The Catalyst Framework Script runner |
24 | |
25 | =head1 SYNOPSIS |
26 | |
27 | See L<Catalyst>. |
28 | |
29 | =head1 DESCRIPTION |
30 | |
31 | This class is responsible for running scripts, either in the application specific namespace |
32 | (e.g. C<MyApp::Script::Server>), or the Catalyst namespace (e.g. C<Catalyst::Script::Server>) |
33 | |
34 | =head1 AUTHORS |
35 | |
36 | Catalyst Contributors, see Catalyst.pm |
37 | |
38 | =head1 COPYRIGHT |
39 | |
40 | This library is free software. You can redistribute it and/or modify it under |
41 | the same terms as Perl itself. |
42 | |
43 | =cut |