From 2389782526e6c35589bb4d9bbadea78559ac1eda Mon Sep 17 00:00:00 2001 From: franck cuny Date: Tue, 26 Oct 2010 17:35:08 +0200 Subject: add role to trace --- lib/Net/HTTP/Spore/Role/Debug.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/Net/HTTP/Spore/Role/Debug.pm (limited to 'lib/Net/HTTP/Spore/Role/Debug.pm') 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; -- cgit v1.2.3