minor typo in Request.pm
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 2773954..ebf88a3 100644 (file)
@@ -3,6 +3,7 @@ package Catalyst;
 use strict;
 use base 'Catalyst::Base';
 use UNIVERSAL::require;
+use Catalyst::Exception;
 use Catalyst::Log;
 use Catalyst::Utils;
 use Text::ASCIITable;
@@ -25,15 +26,15 @@ Catalyst - The Elegant MVC Web Application Framework
     cd MyApp
 
     # add models, views, controllers
-    script/create.pl model Something
-    script/create.pl view Stuff
-    script/create.pl controller Yada
+    script/myapp_create.pl model Something
+    script/myapp_create.pl view Stuff
+    script/myapp_create.pl controller Yada
 
     # built in testserver
-    script/server.pl
+    script/myapp_server.pl
 
     # command line interface
-    script/test.pl /yada
+    script/myapp_test.pl /yada
 
 
     use Catalyst;
@@ -62,9 +63,6 @@ See also L<Catalyst::Manual::Intro>
 
 =head1 DESCRIPTION
 
-Catalyst is based upon L<Maypole>, which you should consider for smaller
-projects.
-
 The key concept of Catalyst is DRY (Don't Repeat Yourself).
 
 See L<Catalyst::Manual> for more documentation.
@@ -190,7 +188,9 @@ sub import {
             }
 
             else {
-                die( qq/Unsupported mod_perl version: $ENV{MOD_PERL}/ );
+                Catalyst::Exception->throw(
+                    message => qq/Unsupported mod_perl version: $ENV{MOD_PERL}/
+                );
             }
         }
 
@@ -199,7 +199,9 @@ sub import {
         }
 
         else {
-            die( qq/Unsupported mod_perl: $ENV{MOD_PERL}/ );
+            Catalyst::Exception->throw(
+                message => qq/Unsupported mod_perl: $ENV{MOD_PERL}/
+            );
         }
     }
 
@@ -232,7 +234,11 @@ sub import {
 
             $plugin->require;
 
-            if ($@) { die qq/Couldn't load plugin "$plugin", "$@"/ }
+            if ( $@ ) { 
+                Catalyst::Exception->throw(
+                    message => qq/Couldn't load plugin "$plugin", "$@"/
+                );
+            }
             else {
                 push @plugins, $plugin;
                 no strict 'refs';
@@ -257,7 +263,13 @@ sub import {
     $dispatcher = "Catalyst::Dispatcher::$appdis" if $appdis;
 
     $dispatcher->require;
-    die qq/Couldn't load dispatcher "$dispatcher", "$@"/ if $@;
+    
+    if ( $@ ) {
+        Catalyst::Exception->throw(
+            message => qq/Couldn't load dispatcher "$dispatcher", "$@"/
+        );
+    }
+
     {
         no strict 'refs';
         push @{"$caller\::ISA"}, $dispatcher;
@@ -272,7 +284,12 @@ sub import {
     $engine = "Catalyst::Engine::$appeng" if $appeng;
 
     $engine->require;
-    die qq/Couldn't load engine "$engine", "$@"/ if $@;
+    
+    if ( $@ ) {
+        Catalyst::Exception->throw(
+            message => qq/Couldn't load engine "$engine", "$@"/
+        );
+    }
 
     {
         no strict 'refs';
@@ -353,13 +370,24 @@ Classdata accessor/mutator will be created, class loaded and instantiated.
 sub plugin {
     my ( $class, $name, $plugin, @args ) = @_;
     $plugin->require;
-    my $error = $UNIVERSAL::require::ERROR;
-    die qq/Couldn't load instant plugin "$plugin", "$error"/ if $error;
+    
+    if ( my $error = $UNIVERSAL::require::ERROR ) {
+        Catalyst::Exception->throw(
+            message => qq/Couldn't load instant plugin "$plugin", "$error"/
+        );
+    }    
+    
     eval { $plugin->import };
     $class->mk_classdata($name);
     my $obj;
     eval { $obj = $plugin->new(@args) };
-    die qq/Couldn't instantiate instant plugin "$plugin", "$@"/ if $@;
+
+    if ( $@ ) {
+        Catalyst::Exception->throw(
+            message => qq/Couldn't instantiate instant plugin "$plugin", "$@"/
+        );
+    }
+
     $class->$name($obj);
     $class->log->debug(qq/Initialized instant plugin "$plugin" as "$name"/)
       if $class->debug;