X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FScriptRunner.pm;h=247ce309c7172508ce938f15fd4b53e3302ad8fa;hb=51f62e09088a7fbdbbe53a76681e1a51e06d328a;hp=c0bb27a85a973c6186d3ed0390ee60122e8e9fec;hpb=12a3e3b57d656c7c48fb3b4b5ca444cb3bfc9360;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/ScriptRunner.pm b/lib/Catalyst/ScriptRunner.pm index c0bb27a..247ce30 100644 --- a/lib/Catalyst/ScriptRunner.pm +++ b/lib/Catalyst/ScriptRunner.pm @@ -11,10 +11,9 @@ sub run { lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib')); - # FIXME - Error handling / reporting - if ( eval { Class::MOP::load_class($classtoload) } ) { - } - else { + unless ( eval { Class::MOP::load_class($classtoload) } ) { + warn("Could not load $classtoload - falling back to Catalyst::Script::$scriptclass : $@\n") + if $@ !~ /Can't locate/; $classtoload = "Catalyst::Script::$scriptclass"; Class::MOP::load_class($classtoload); } @@ -25,17 +24,26 @@ __PACKAGE__->meta->make_immutable; =head1 NAME -Catalyst::ScriptRunner - The Catalyst Framework Script runner +Catalyst::ScriptRunner - The Catalyst Framework script runner =head1 SYNOPSIS -See L. + # Will run MyApp::Script::Server if it exists, otherwise + # will run Catalyst::Script::Server. + Catalyst::ScriptRunner->run('MyApp', 'Server'); =head1 DESCRIPTION This class is responsible for running scripts, either in the application specific namespace (e.g. C), or the Catalyst namespace (e.g. C) +=head1 METHODS + +=head2 run ($application_class, $scriptclass) + +Called with two parameters, the application classs (e.g. MyApp) +and the script class, (i.e. one of Server/FastCGI/CGI/Create/Test) + =head1 AUTHORS Catalyst Contributors, see Catalyst.pm