dump LWP with DEBUG=1
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 28 Jul 2012 18:59:37 +0000 (20:59 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 28 Jul 2012 18:59:37 +0000 (20:59 +0200)
CouchDB.pm

index 9512174..9f8cf56 100644 (file)
@@ -15,6 +15,11 @@ sub new {
   $ua->timeout(10);
   $ua->env_proxy;
 
+  if ( $ENV{DEBUG} ) {
+       $ua->add_handler("request_send",  sub { shift->dump; return });
+       $ua->add_handler("response_done", sub { shift->dump; return });
+  }
+
   return bless {
                 ua       => $ua,
                 host     => $host,