[Catalyst-commits] r7971 - in Catalyst-Runtime/5.80/trunk: . lib

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Mon Jun 23 22:01:08 BST 2008


Author: groditi
Date: 2008-06-23 22:01:08 +0100 (Mon, 23 Jun 2008)
New Revision: 7971

Modified:
   Catalyst-Runtime/5.80/trunk/
   Catalyst-Runtime/5.80/trunk/TODO
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
 r17018 at martha (orig r7530):  groditi | 2008-03-26 19:42:35 -0400
 little things in Catalyst.pm



Property changes on: Catalyst-Runtime/5.80/trunk
___________________________________________________________________
Name: svk:merge
   - 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:7576
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7529
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
   + 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:7576
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7530
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442

Modified: Catalyst-Runtime/5.80/trunk/TODO
===================================================================
--- Catalyst-Runtime/5.80/trunk/TODO	2008-06-23 21:01:01 UTC (rev 7970)
+++ Catalyst-Runtime/5.80/trunk/TODO	2008-06-23 21:01:08 UTC (rev 7971)
@@ -12,6 +12,9 @@
 
 
   - GRODITI's list:
+    * Update Test suite to not assume MyApp ISA Controller
+      - After that I'll set up attr handlers that will output helpful
+        error messages when you do it as well as how to fix it.
     * comments marked /Moose TODO/i in the code
     * Fix the CDI compat hack so we can start moving to immutable
     * Profile before and after immutable.

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2008-06-23 21:01:01 UTC (rev 7970)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2008-06-23 21:01:08 UTC (rev 7971)
@@ -30,14 +30,14 @@
 
 BEGIN { require 5.008001; }
 
-has stack     => (is => 'rw');
-has stash     => (is => 'rw');
-has state     => (is => 'rw');
-has stats     => (is => 'rw');
-has action    => (is => 'rw');
-has counter   => (is => 'rw');
-has request   => (is => 'rw');
-has response  => (is => 'rw');
+has stack => (is => 'rw');
+has stash => (is => 'rw');
+has state => (is => 'rw');
+has stats => (is => 'rw');
+has action => (is => 'rw');
+has counter => (is => 'rw');
+has request => (is => 'rw');
+has response => (is => 'rw');
 has namespace => (is => 'rw');
 
 
@@ -59,6 +59,8 @@
 our $RECURSION = 1000;
 our $DETACH    = "catalyst_detach\n";
 
+#I imagine that very few of these really need to be class variables. if any.
+#maybe we should just make them attributes with a default?
 __PACKAGE__->mk_classdata($_)
   for qw/components arguments dispatcher engine log dispatcher_class
   engine_class context_class request_class response_class stats_class
@@ -84,13 +86,17 @@
     my $caller = caller(0);
 
     #why does called have to ISA Catalyst and ISA Controller ?
+    #Convert test suite to not use the behavior where Myapp ISA Controller
+    # after that is done we can eliminate that little mess.
     unless ( $caller->isa('Catalyst') ) {
         no strict 'refs';
         if( $caller->can('meta') ){
           my @superclasses = ($caller->meta->superclasses, $class, 'Catalyst::Controller');
+          #my @superclasses = ($caller->meta->superclasses, $class);
           $caller->meta->superclasses(@superclasses);
         } else {
           push @{"$caller\::ISA"}, $class, 'Catalyst::Controller';
+          #push @{"$caller\::ISA"}, $class;
         }
     }
 
@@ -1543,6 +1549,7 @@
     }
 
     $COUNT++;
+    #todo: reuse coderef from can
     $class->log->_flush() if $class->log->can('_flush');
     return $status;
 }
@@ -1557,6 +1564,7 @@
 sub prepare {
     my ( $class, @arguments ) = @_;
 
+    #moose todo: context_class as attr with default
     $class->context_class( ref $class || $class ) unless $class->context_class;
     #Moose TODO: if we make empty containers the defaults then that can be
     #handled by the context class itself instead of having this here
@@ -1590,6 +1598,7 @@
         }
     );
 
+    #surely this is not the most efficient way to do things...
     $c->stats($class->stats_class->new)->enable($c->use_stats);
     if ( $c->debug ) {
         $c->res->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
@@ -1972,9 +1981,6 @@
     }
 
     Class::MOP::load_class($dispatcher);
-    #unless (Class::Inspector->loaded($dispatcher)) {
-    #    require Class::Inspector->filename($dispatcher);
-    #}
 
     # dispatcher instance
     $class->dispatcher( $dispatcher->new );
@@ -2114,11 +2120,8 @@
         $home = $env;
     }
 
-    unless ($home) {
-        $home = Catalyst::Utils::home($class);
-    }
+    $home ||= Catalyst::Utils::home($class);
 
-    #I remember recently being scolded for assigning config values like this
     if ($home) {
         #I remember recently being scolded for assigning config values like this
         $class->config->{home} ||= $home;
@@ -2207,7 +2210,7 @@
         # no ignore_loaded here, the plugin may already have been
         # defined in memory and we don't want to error on "no file" if so
 
-        Catalyst::Utils::ensure_class_loaded( $plugin );
+        Class::MOP::load_class( $plugin );
 
         $proto->_plugins->{$plugin} = 1;
         unless ($instant) {




More information about the Catalyst-commits mailing list