[Catalyst-commits] r13534 - in Catalyst-Runtime/5.80/trunk: . lib t t/lib t/lib/TestAppShowInternalActions t/lib/TestAppShowInternalActions/Controller

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Aug 25 22:53:20 GMT 2010


Author: t0m
Date: 2010-08-25 23:53:20 +0100 (Wed, 25 Aug 2010)
New Revision: 13534

Added:
   Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions.pm
   Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions/
   Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions/Controller/
   Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions/Controller/Root.pm
   Catalyst-Runtime/5.80/trunk/t/live_show_internal_actions_warnings.t
Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
Fix RT#59738, show_internal_actions produces warnings in debug mode

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2010-08-25 22:12:38 UTC (rev 13533)
+++ Catalyst-Runtime/5.80/trunk/Changes	2010-08-25 22:53:20 UTC (rev 13534)
@@ -6,6 +6,8 @@
     to always be parsed for logging at the end of the request when in
     debug mode. This has been fixed so that if the body has not been parsed
     by the time the request is logged, then the body is omitted.
+  - Fix show_internal_actions config setting producing warnings in debug
+    mode (RT#59738)
 
 5.80025 2010-07-29 01:50:00
 

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2010-08-25 22:12:38 UTC (rev 13533)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2010-08-25 22:53:20 UTC (rev 13534)
@@ -1701,7 +1701,7 @@
         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"},

Added: Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions/Controller/Root.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions/Controller/Root.pm	2010-08-25 22:53:20 UTC (rev 13534)
@@ -0,0 +1,19 @@
+package TestAppShowInternalActions::Controller::Root;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller' }
+
+__PACKAGE__->config(namespace => '');
+
+sub index :Path :Args(0) {
+    my ( $self, $c ) = @_;
+
+    $c->response->body( 'hello world' );
+}
+
+sub end : Action {}
+
+__PACKAGE__->meta->make_immutable;
+
+1;

Added: Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestAppShowInternalActions.pm	2010-08-25 22:53:20 UTC (rev 13534)
@@ -0,0 +1,20 @@
+package TestAppShowInternalActions;
+use Moose;
+use namespace::autoclean;
+
+use Catalyst::Runtime 5.80;
+
+use Catalyst qw/ -Debug /; # Debug must remain on for
+                           # t/live_show_internal_actions_warnings.t
+
+extends 'Catalyst';
+
+__PACKAGE__->config(
+    name => 'TestAppShowInternalActions',
+    disable_component_resolution_regex_fallback => 1,
+    show_internal_actions => 1,
+);
+
+__PACKAGE__->setup();
+
+1;

Added: Catalyst-Runtime/5.80/trunk/t/live_show_internal_actions_warnings.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/live_show_internal_actions_warnings.t	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/live_show_internal_actions_warnings.t	2010-08-25 22:53:20 UTC (rev 13534)
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+use FindBin '$Bin';
+use lib "$Bin/lib";
+use Test::More;
+use File::Spec;
+BEGIN { # Shut up debug output, app needs debug on for the issue to
+        # appear, but we don't want the spraff to the screen
+
+    my $devnull = File::Spec->devnull;
+    open my $fh, '>', $devnull or die "Cannot write to $devnull: $!";
+
+    *STDERR = $fh;
+}
+
+use Catalyst::Test 'TestAppShowInternalActions';
+
+my $last_warning;
+{
+    local $SIG{__WARN__} = sub { $last_warning = shift };
+    get('/');
+}
+is( $last_warning, undef, 'there should be no warnings about uninitialized value' );
+
+done_testing;




More information about the Catalyst-commits mailing list