[Catalyst-commits] r12015 - in Catalyst-Runtime/5.80/branches/better_scripts: . lib/Catalyst t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Nov 25 22:32:11 GMT 2009


Author: t0m
Date: 2009-11-25 22:32:11 +0000 (Wed, 25 Nov 2009)
New Revision: 12015

Modified:
   Catalyst-Runtime/5.80/branches/better_scripts/TODO.scripts
   Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ScriptRunner.pm
   Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t
Log:
Fix warnings from ScriptRunner

Modified: Catalyst-Runtime/5.80/branches/better_scripts/TODO.scripts
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/TODO.scripts	2009-11-25 21:22:17 UTC (rev 12014)
+++ Catalyst-Runtime/5.80/branches/better_scripts/TODO.scripts	2009-11-25 22:32:11 UTC (rev 12015)
@@ -1,5 +1,3 @@
 * $ARGV[0] has slipped to $ARGV[1] in ::Test
-* ScriptRunner tests for MyApp::Script::DoesNotCompile
 * Sort out help so that it shows what you fucked up.
 * Fix horrible hacking around MX::Getopt's help display - probably by fixing MX::Getopt.
-* Tests for ::Create

Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ScriptRunner.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ScriptRunner.pm	2009-11-25 21:22:17 UTC (rev 12014)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ScriptRunner.pm	2009-11-25 22:32:11 UTC (rev 12015)
@@ -11,10 +11,12 @@
 
     lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
 
+    warn("load $classtoload or Catalyst::Script::$scriptclass");
+
     # 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);
     }

Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t	2009-11-25 21:22:17 UTC (rev 12014)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t	2009-11-25 22:32:11 UTC (rev 12015)
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Test::More tests => 5;
+use Test::More;
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 
@@ -13,4 +13,12 @@
 is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'Catalyst::Script::Baz',
     'Script existing only in Catalyst';
 # +1 test for the params passed to new_with_options in t/lib/Catalyst/Script/Baz.pm
+{
+    my $warnings = '';
+    local $SIG{__WARN__} = sub { $warnings .= shift };
+    is 'Catalyst::Script::CompileTest', Catalyst::ScriptRunner->run('ScriptTestApp', 'CompileTest');
+    like $warnings, qr/Does not compile/;
+    like $warnings, qr/Could not load ScriptTestApp::Script::CompileTest - falling back to Catalyst::Script::CompileTest/;
+}
 
+done_testing;




More information about the Catalyst-commits mailing list