diff options
author | franck cuny <franck@lumberjaph.net> | 2010-11-24 12:00:48 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-11-24 12:00:48 +0100 |
commit | f6f0ee797c94005e1b120f77b1146f8106bc2c1e (patch) | |
tree | 236839167cd3249da873b8f2157f384c911ca1f4 | |
parent | fix an issue where content-type was not set correctly (diff) | |
download | net-http-spore-f6f0ee797c94005e1b120f77b1146f8106bc2c1e.tar.gz |
stringify body to a usefull message
-rw-r--r-- | lib/Net/HTTP/Spore/Response.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Net/HTTP/Spore/Response.pm b/lib/Net/HTTP/Spore/Response.pm index 0696d2b..95ee72b 100644 --- a/lib/Net/HTTP/Spore/Response.pm +++ b/lib/Net/HTTP/Spore/Response.pm @@ -5,7 +5,10 @@ package Net::HTTP::Spore::Response; use strict; use warnings; -use overload '@{}' => \&finalize, fallback => 1; +use overload + '@{}' => \&finalize, + '""' => \&to_string, + fallback => 1; use HTTP::Headers; @@ -91,8 +94,14 @@ sub header { $self->headers->header(@_); } +sub to_string { + my $self = shift; + return "HTTP status: ".$self->{status}; +} + sub finalize { my $self = shift; + return [ $self->status, +[ |