that sounds about right. here is a proposed patch:

diff --git a/lib/Catalyst/Action/Serialize.pm b/lib/Catalyst/Action/Serialize.pm
index 29ee605..27f00a4 100644
--- a/lib/Catalyst/Action/Serialize.pm
+++ b/lib/Catalyst/Action/Serialize.pm
@@ -23,7 +23,7 @@ sub execute {
     $self->maybe::next::method(@_);

     return 1 if $c->req->method eq 'HEAD';
-    return 1 if length( $c->response->body );
+    return 1 if defined $c->response->body && length( $c->response->body );
     return 1 if scalar @{ $c->error };
     return 1 if $c->response->status =~ /^(?:204)$/;

diff --git a/t/catalyst-action-serialize.t b/t/catalyst-action-serialize.t
index 78ce12b..43d793d 100644
--- a/t/catalyst-action-serialize.t
+++ b/t/catalyst-action-serialize.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Test::More tests => 9;
+use Test::More tests => 11;
 use Data::Serializer;
 use FindBin;

@@ -35,4 +35,8 @@ $res2 = request($t->get(url => '/serialize/test_second'));
 ok( $res2->is_success, 'request succeeded (deprecated config)' );
 is( $res2->content, "{'lou' => 'is my cat'}", "request returned proper data");

+my $emptyres = request($t->get(url => '/serialize/empty'));
+is $emptyres->content, '';
+ok !$emptyres->header('Content-Length');
+
 1;
diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm
b/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm
index 9d358c4..63cba8f 100644
--- a/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm
+++ b/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm
@@ -32,4 +32,8 @@ sub test_second :Local :ActionClass('Serialize') {
     };
 }

+sub empty :Local :ActionClass('Serialize') {
+  return undef;
+}
+
 1;


Justin


On Thu, Jan 6, 2011 at 3:17 PM, Chad House <[email protected]> wrote:

> Testing out Catalyst::Runtime 5.80030, I noticed
> Catalyst::Action::Serialize (0.87) complaining about "Use of
> uninitialized value in length" -- it's testing the length of
> $c->response->body, which can now be undefined I gather.
>
> Cheers,
>
> Chad
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to