Changelog and dep bump for more_metaclass_compat branch merge
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 08f85f3..1c96763 100644 (file)
@@ -77,9 +77,18 @@ __PACKAGE__->request_class('Catalyst::Request');
 __PACKAGE__->response_class('Catalyst::Response');
 __PACKAGE__->stats_class('Catalyst::Stats');
 
-# Remember to update this in Catalyst::Runtime as well!
+# This is here as but we need to be able to call# C::C->action_class, which
+# calls the ->_action_class attribute's accessor to get the default action
+# class for this controller. As the app class is also a controller (eww, warns)
+# but we don't have an instance (just the component name) in the registery,
+# we override _action_class here so that $class->_action_class doesn't explode
+# (so it becomes class data rather than instance data for this one special case).
+# This is a gross back compat hack which can go away for app/ctx split.
+__PACKAGE__->mk_classdata(qw/ _action_class /);
+__PACKAGE__->_action_class('Catalyst::Action');
 
-our $VERSION = '5.80023';
+# Remember to update this in Catalyst::Runtime as well!
+our $VERSION = '5.80024';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -1154,7 +1163,7 @@ EOF
 
     # Add our self to components, since we are also a component
     if( $class->isa('Catalyst::Controller') ){
-      $class->components->{$class} = $class;
+      $class->components->{$class} = $class; # HATEFUL SPECIAL CASE
     }
 
     $class->setup_actions;
@@ -1757,7 +1766,7 @@ sub finalize {
     $c->log_response;
 
     if ($c->use_stats) {
-        my $elapsed = sprintf '%f', $c->stats->elapsed;
+        my $elapsed = $c->stats->elapsed;
         my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed;
         $c->log->info(
             "Request took ${elapsed}s ($av/s)\n" . $c->stats->report . "\n" );
@@ -2406,10 +2415,6 @@ sub setup_components {
         # we know M::P::O found a file on disk so this is safe
 
         Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded => 1 } );
-
-        # Needs to be done as soon as the component is loaded, as loading a sub-component
-        # (next time round the loop) can cause us to get the wrong metaclass..
-        $class->_controller_init_base_classes($component);
     }
 
     for my $component (@comps) {
@@ -2419,7 +2424,6 @@ sub setup_components {
             : $class->expand_component_module( $component, $config );
         for my $component (@expanded_components) {
             next if $comps{$component};
-            $class->_controller_init_base_classes($component); # Also cover inner packages
             $class->components->{ $component } = $class->setup_component($component);
         }
     }
@@ -2472,19 +2476,6 @@ sub expand_component_module {
 
 =cut
 
-# FIXME - Ugly, ugly hack to ensure the we force initialize non-moose base classes
-#         nearest to Catalyst::Controller first, no matter what order stuff happens
-#         to be loaded. There are TODO tests in Moose for this, see
-#         f2391d17574eff81d911b97be15ea51080500003
-sub _controller_init_base_classes {
-    my ($app_class, $component) = @_;
-    return unless $component->isa('Catalyst::Controller');
-    foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) {
-        Moose::Meta::Class->initialize( $class )
-            unless find_meta($class);
-    }
-}
-
 sub setup_component {
     my( $class, $component ) = @_;
 
@@ -3181,6 +3172,8 @@ random: Roland Lammel <lammel@cpan.org>
 
 Robert Sedlacek C<< <rs@474.at> >>
 
+SpiceMan: Marcel Montes
+
 sky: Arthur Bergman
 
 szbalint: Balint Szilakszi <szbalint@cpan.org>