1 package Catalyst::ScriptRunner;
6 use namespace::autoclean;
9 my ($self, $class, $scriptclass) = @_;
10 my $classtoload = "${class}::Script::$scriptclass";
12 lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
14 # FIXME - Error handling / reporting
15 if ( eval { Class::MOP::load_class($classtoload) } ) {
18 $classtoload = "Catalyst::Script::$scriptclass";
19 Class::MOP::load_class($classtoload);
21 $classtoload->new_with_options( application_name => $class )->run;
24 __PACKAGE__->meta->make_immutable;
28 Catalyst::ScriptRunner - The Catalyst Framework script runner
32 # Will run MyApp::Script::Server if it exists, otherwise
33 # will run Catalyst::Script::Server.
34 Catalyst::ScriptRunner->run('MyApp', 'Server');
38 This class is responsible for running scripts, either in the application specific namespace
39 (e.g. C<MyApp::Script::Server>), or the Catalyst namespace (e.g. C<Catalyst::Script::Server>)
43 =head2 run ($application_class, $scriptclass)
45 Called with two parameters, the application classs (e.g. MyApp)
46 and the script class, (i.e. one of Server/FastCGI/CGI/Create/Test)
50 Catalyst Contributors, see Catalyst.pm
54 This library is free software. You can redistribute it and/or modify it under
55 the same terms as Perl itself.