[Catalyst] Re: Catalyst-Plugin-Compress-Zlib

A. Pagaltzis pagaltzis at gmx.de
Thu Jul 26 20:46:44 GMT 2007


* Bill Moseley <moseley at hank.org> [2007-07-26 19:30]:
> Looking at an existing version I hacked I see I did something a
> bit more crude:

Crude is better in Perl. Handle-like things come in so many
shapes that testing for them is futile at best, stupid at worst.

>     my $body = $c->response->body;
>     $body = join "\n", <$body> : $body if ref $body;

    my $body = $c->response->body;
    eval { local $/; $body = <$body> } if ref $body;
    die "Response body is an unsupported kind of reference" if ref $body;

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle



More information about the Catalyst mailing list