FAQ
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

Search Discussions

  • Justin Hunter at Jan 7, 2011 at 12:36 pm
    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 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: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110107/a21a1e70/attachment.htm
  • Tomas Doran at Jan 12, 2011 at 9:03 pm

    On 7 Jan 2011, at 12:36, Justin Hunter wrote:

    that sounds about right. here is a proposed patch:
    Applied with some changes and extra tests.

    Released.

    Thanks!

    t0m

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 6, '11 at 8:17p
activeJan 12, '11 at 9:03p
posts3
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase