Fix RT#59738, show_internal_actions produces warnings in debug mode
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 1c96763..56ed57f 100644 (file)
@@ -77,18 +77,9 @@ __PACKAGE__->request_class('Catalyst::Request');
 __PACKAGE__->response_class('Catalyst::Response');
 __PACKAGE__->stats_class('Catalyst::Stats');
 
-# 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');
-
 # Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.80024';
+
+our $VERSION = '5.80025';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -901,7 +892,7 @@ component is constructed.
 For example:
 
     MyApp->config({ 'Model::Foo' => { bar => 'baz', overrides => 'me' } });
-    MyApp::Model::Foo->config({ quux => 'frob', 'overrides => 'this' });
+    MyApp::Model::Foo->config({ quux => 'frob', overrides => 'this' });
 
 will mean that C<MyApp::Model::Foo> receives the following data when
 constructed:
@@ -912,6 +903,21 @@ constructed:
         overrides => 'me',
     });
 
+It's common practice to use a Moose attribute
+on the receiving component to access the config value.
+
+    package MyApp::Model::Foo;
+
+    use Moose;
+
+    # this attr will receive 'baz' at construction time
+    has 'bar' => ( 
+        is  => 'rw',
+        isa => 'Str',
+    );
+
+You can then get the value 'baz' by calling $c->model('Foo')->bar
+
 =cut
 
 around config => sub {
@@ -1163,7 +1169,7 @@ EOF
 
     # Add our self to components, since we are also a component
     if( $class->isa('Catalyst::Controller') ){
-      $class->components->{$class} = $class; # HATEFUL SPECIAL CASE
+      $class->components->{$class} = $class;
     }
 
     $class->setup_actions;
@@ -1236,7 +1242,9 @@ sub setup_finalize {
 
 Constructs an absolute L<URI> object based on the application root, the
 provided path, and the additional arguments and query parameters provided.
-When used as a string, provides a textual URI.
+When used as a string, provides a textual URI.  If you need more flexibility
+than this (i.e. the option to provide relative URIs etc.) see
+L<Catalyst::Plugin::SmartURI>.
 
 If no arguments are provided, the URI for the current action is returned.
 To return the current action and also provide @args, use
@@ -1693,7 +1701,7 @@ sub _stats_start_execute {
         my $parent = $c->stack->[-1];
 
         # forward, locate the caller
-        if ( exists $c->counter->{"$parent"} ) {
+        if ( defined $parent && exists $c->counter->{"$parent"} ) {
             $c->stats->profile(
                 begin  => $action,
                 parent => "$parent" . $c->counter->{"$parent"},
@@ -1766,7 +1774,7 @@ sub finalize {
     $c->log_response;
 
     if ($c->use_stats) {
-        my $elapsed = $c->stats->elapsed;
+        my $elapsed = sprintf '%f', $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" );
@@ -2142,7 +2150,7 @@ sub log_request {
         $c->log->debug("Query keywords are: $keywords");
     }
 
-    $c->log_request_parameters( query => $request->query_parameters, body => $request->body_parameters );
+    $c->log_request_parameters( query => $request->query_parameters, $request->_has_body ? (body => $request->body_parameters) : () );
 
     $c->log_request_uploads($request);
 }
@@ -2399,8 +2407,7 @@ sub setup_components {
 
     my $config  = $class->config->{ setup_components };
 
-    my @comps = sort { length $a <=> length $b }
-                $class->locate_components($config);
+    my @comps = $class->locate_components($config);
     my %comps = map { $_ => 1 } @comps;
 
     my $deprecatedcatalyst_component_names = grep { /::[CMV]::/ } @comps;
@@ -2455,7 +2462,8 @@ sub locate_components {
         %$config
     );
 
-    my @comps = $locator->plugins;
+    # XXX think about ditching this sort entirely
+    my @comps = sort { length $a <=> length $b } $locator->plugins;
 
     return @comps;
 }
@@ -3192,6 +3200,8 @@ wreis: Wallace Reis <wallace@reis.org.br>
 
 Yuval Kogman, C<nothingmuch@woobling.org>
 
+rainboxx: Matthias Dietrich, C<perl@rainboxx.de>
+
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify it under