[Jifty-commit] r4141 - in jifty/trunk: lib lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Sep 19 22:43:19 EDT 2007
Author: jesse
Date: Wed Sep 19 22:43:18 2007
New Revision: 4141
Modified:
jifty/trunk/ (props changed)
jifty/trunk/META.yml
jifty/trunk/lib/Jifty.pm
jifty/trunk/lib/Jifty/ClassLoader.pm
jifty/trunk/lib/Jifty/Dispatcher.pm
jifty/trunk/lib/Jifty/Everything.pm
jifty/trunk/lib/Jifty/Plugin.pm
Log:
r67430 at pinglin: jesse | 2007-09-19 22:41:42 -0400
* Switch to a single call to Module::Pluggable to help improve startup performance.
Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml (original)
+++ jifty/trunk/META.yml Wed Sep 19 22:43:18 2007
@@ -27,6 +27,7 @@
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 Wed Sep 19 22:43:18 2007
@@ -167,6 +167,9 @@
# 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 Wed Sep 19 22:43:18 2007
@@ -2,6 +2,24 @@
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
@@ -320,17 +338,16 @@
# Use Module::Pluggable to help locate our models, actions, notifications,
# and events
- 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
- );
+
+ foreach my $found (keys %DISCOVERED_CLASSES) {
+ next unless ($found =~ /${base}::(?:Model|Action|Notification|Event)/);
+ Jifty::Util->require($found);
+ }
+
# Construct the list of models for the application for later reference
my %models;
- $models{$_} = 1 for grep {/^($base)::Model::(.*)$/ and not /Collection(?:$||\:\:)/} $self->plugins;
+ $models{$_} = 1 for grep {/^($base)::Model::(.*)$/ and not /Collection(?:$||\:\:)/} keys %DISCOVERED_CLASSES;
$self->models(sort keys %models);
# Load all those models and model-related actions, notifications, and events
Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm Wed Sep 19 22:43:18 2007
@@ -422,6 +422,7 @@
my $stage = shift;
my $pkg = ref($self) || $self;
no strict 'refs';
+ no warnings 'once';
@{ $pkg . '::RULES_' . $stage };
}
Modified: jifty/trunk/lib/Jifty/Everything.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Everything.pm (original)
+++ jifty/trunk/lib/Jifty/Everything.pm Wed Sep 19 22:43:18 2007
@@ -78,9 +78,7 @@
use Jifty::Subs::Render ();
use Jifty::Module::Pluggable;
-Jifty::Module::Pluggable->import(search_path => ['Jifty::Web::Form::Field'],
- require => 1,
- except => qr/\.#/);
-__PACKAGE__->plugins;
+#Jifty::Module::Pluggable->import(search_path => ['Jifty::Web::Form::Field'], require => 1, except => qr/\.#/);
+#__PACKAGE__->plugins;
1;
Modified: jifty/trunk/lib/Jifty/Plugin.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin.pm Wed Sep 19 22:43:18 2007
@@ -55,7 +55,6 @@
my $self = $class->SUPER::new( { @_ });
# Get a classloader set up
- Jifty::ClassLoader->new(base => $class)->require;
Jifty::Util->require($class->dispatcher);
# XXX TODO: Add .po path
More information about the Jifty-commit
mailing list