summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-11-24 12:00:48 +0100
committerfranck cuny <franck@lumberjaph.net>2010-11-24 12:00:48 +0100
commitf6f0ee797c94005e1b120f77b1146f8106bc2c1e (patch)
tree236839167cd3249da873b8f2157f384c911ca1f4
parentfix an issue where content-type was not set correctly (diff)
downloadnet-http-spore-f6f0ee797c94005e1b120f77b1146f8106bc2c1e.tar.gz
stringify body to a usefull message
-rw-r--r--lib/Net/HTTP/Spore/Response.pm11
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,
         +[