[Jifty-commit] r4143 - in jifty/trunk: lib lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Sep 20 12:00:21 EDT 2007


Author: jesse
Date: Thu Sep 20 12:00:20 2007
New Revision: 4143

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/META.yml
   jifty/trunk/lib/Jifty.pm
   jifty/trunk/lib/Jifty/ClassLoader.pm

Log:
 r67448 at pinglin:  jesse | 2007-09-20 11:59:56 -0400
 * Some parts of that last commit to use only one Module::Pluggable weren't as hot as they appeared to be;


Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml	(original)
+++ jifty/trunk/META.yml	Thu Sep 20 12:00:20 2007
@@ -27,7 +27,6 @@
   DBD::SQLite: 0
   Devel::Cover: 0
   Devel::EvalContext: 0
-  Devel::Events: 0.02
   GD: 0
   GD::Graph: 0
   Image::Info: 0

Modified: jifty/trunk/lib/Jifty.pm
==============================================================================
--- jifty/trunk/lib/Jifty.pm	(original)
+++ jifty/trunk/lib/Jifty.pm	Thu Sep 20 12:00:20 2007
@@ -167,9 +167,6 @@
     # Logger turn on
     Jifty->logger( Jifty::Logger->new( $args{'logger_component'} ) );
 
-
-    Jifty::ClassLoader->_discover_classes(Jifty->app_class());
-
     # Set up plugins
     my @plugins;
     my @plugins_to_load = @{Jifty->config->framework('Plugins')};

Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm	Thu Sep 20 12:00:20 2007
@@ -2,24 +2,6 @@
 use strict;
 
 package Jifty::ClassLoader;
-use Jifty;
-use Jifty::Module::Pluggable;
-
-our %DISCOVERED_CLASSES;
-
-sub _discover_classes {
-    my $class =shift;
-    my $app_class = shift;
-Jifty::Module::Pluggable->import(
-        search_path => [ 'Jifty',$app_class],
-        require => 0,
-        except  => qr/\.#/,
-        inner   => 0
-);
-    
- %DISCOVERED_CLASSES = map { $_ => 1 } __PACKAGE__->plugins();
-}
-
 
 =head1 NAME
 
@@ -338,16 +320,17 @@
 
     # Use Module::Pluggable to help locate our models, actions, notifications,
     # and events
-    
-   foreach my $found (keys %DISCOVERED_CLASSES) {
-        next unless ($found =~ /${base}::(?:Model|Action|Notification|Event)/);
-        Jifty::Util->require($found);
-   }
-
+    Jifty::Module::Pluggable->import(
+        # $base goes last so we pull in the view class AFTER the model classes
+        search_path => [map { $base . "::" . $_ } ('Model', 'Action', 'Notification', 'Event')],
+        require => 1,
+        except  => qr/\.#/,
+        inner   => 0
+    );
     
     # Construct the list of models for the application for later reference
     my %models;
-    $models{$_} = 1 for grep {/^($base)::Model::(.*)$/ and not /Collection(?:$||\:\:)/} keys %DISCOVERED_CLASSES;
+    $models{$_} = 1 for grep {/^($base)::Model::(.*)$/ and not /Collection(?:$||\:\:)/} $self->plugins;
     $self->models(sort keys %models);
 
     # Load all those models and model-related actions, notifications, and events


More information about the Jifty-commit mailing list