summary refs log tree commit diff
path: root/lib/Net/HTTP/Spore/Role/Debug.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-10-26 17:35:08 +0200
committerfranck cuny <franck@lumberjaph.net>2010-10-26 17:35:08 +0200
commit2389782526e6c35589bb4d9bbadea78559ac1eda (patch)
tree89ab004cc9edfb2a76ec60ebd14f1c973b6e0c5b /lib/Net/HTTP/Spore/Role/Debug.pm
parentadd expected_status to top level (diff)
downloadnet-http-spore-2389782526e6c35589bb4d9bbadea78559ac1eda.tar.gz
add role to trace
Diffstat (limited to 'lib/Net/HTTP/Spore/Role/Debug.pm')
-rw-r--r--lib/Net/HTTP/Spore/Role/Debug.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Net/HTTP/Spore/Role/Debug.pm b/lib/Net/HTTP/Spore/Role/Debug.pm
new file mode 100644
index 0000000..772373a
--- /dev/null
+++ b/lib/Net/HTTP/Spore/Role/Debug.pm
@@ -0,0 +1,14 @@
+package Net::HTTP::Spore::Role::Debug;
+
+use Moose::Role;
+
+has trace => (
+    is      => 'rw',
+    isa     => 'Bool',
+    lazy    => 1,
+    default => sub { $ENV{SPORE_TRACE} ? 1 : 0; }
+);
+
+sub _trace_msg { print STDOUT $_[1]."\n" if $_[0]->trace; }
+
+1;