summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-02-03 18:11:31 +0100
committerfranck cuny <franck@lumberjaph.net>2011-07-26 13:19:58 +0200
commitebf98f6927b839015323733636a8e10e22ee6faa (patch)
tree7e728d0f0cbd1b659719f06246293ff5e3b0791e
parentfix a problem when decoding serialized content when not needed (diff)
downloadnet-http-spore-ebf98f6927b839015323733636a8e10e22ee6faa.tar.gz
trying to finish the trace stuff ..
-rw-r--r--lib/Net/HTTP/Spore/Meta/Method/Spore.pm6
-rw-r--r--lib/Net/HTTP/Spore/Role/Debug.pm9
-rw-r--r--lib/Net/HTTP/Spore/Role/Request.pm6
3 files changed, 13 insertions, 8 deletions
diff --git a/lib/Net/HTTP/Spore/Meta/Method/Spore.pm b/lib/Net/HTTP/Spore/Meta/Method/Spore.pm
index f820d88..1cea574 100644
--- a/lib/Net/HTTP/Spore/Meta/Method/Spore.pm
+++ b/lib/Net/HTTP/Spore/Meta/Method/Spore.pm
@@ -54,12 +54,6 @@ sub add_spore_method {
 
     my $code = delete $options{code};
 
-#    $meta->_trace_msg( '-> attach '
-#          . $name . ' ('
-#          . $options{method} . ' => '
-#          . $options{path}
-#          . ')' );
-
     $meta->add_method(
         $name,
         Net::HTTP::Spore::Meta::Method->wrap(
diff --git a/lib/Net/HTTP/Spore/Role/Debug.pm b/lib/Net/HTTP/Spore/Role/Debug.pm
index 772373a..e178c42 100644
--- a/lib/Net/HTTP/Spore/Role/Debug.pm
+++ b/lib/Net/HTTP/Spore/Role/Debug.pm
@@ -9,6 +9,13 @@ has trace => (
     default => sub { $ENV{SPORE_TRACE} ? 1 : 0; }
 );
 
-sub _trace_msg { print STDOUT $_[1]."\n" if $_[0]->trace; }
+has handle => (
+    is => 'rw', isa => 'Object',
+);
+
+sub _trace_msg {
+    my $self = shift;
+    print STDOUT $_[0]."\n" if $self->trace;
+}
 
 1;
diff --git a/lib/Net/HTTP/Spore/Role/Request.pm b/lib/Net/HTTP/Spore/Role/Request.pm
index 0af15f7..832549d 100644
--- a/lib/Net/HTTP/Spore/Role/Request.pm
+++ b/lib/Net/HTTP/Spore/Role/Request.pm
@@ -67,7 +67,11 @@ sub _execute_middlewares_on_response {
 sub _request {
     my ($self, $request) = @_;
 
-    my $result = $self->request($request->finalize);
+    my $req_final = $request->finalize();
+
+    $self->_trace_msg( $req_final->method . ' ' . $req_final->url );
+
+    my $result = $self->request($req_final);
 
     my $response = $request->new_response(
         $result->code,