From: Jonathan Rockway <jon@jrock.us>
Date: Tue, 12 May 2009 00:09:43 +0000 (-0500)
Subject: add a _debug_message method to +Debug plugin for use of other plugins
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ebff6508ed8ec98ba625ccae9bbf41d3b7bbd52;p=gitmo%2FMooseX-Runnable.git

add a _debug_message method to +Debug plugin for use of other plugins
---

diff --git a/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm b/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm
index 00db16a..4d1ce96 100644
--- a/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm
+++ b/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm
@@ -22,6 +22,11 @@ sub _build_initargs_from_cmdline {
     return;
 }
 
+sub _debug_message {
+    my ($self, @msg) = @_;
+    print {*STDERR} $self->debug_prefix, "[$$] ", @msg, "\n";
+}
+
 for my $method (qw{
     load_class apply_scheme validate_class
     create_instance start_application
@@ -31,12 +36,12 @@ for my $method (qw{
     before $method => sub {
         my ($self, @args) = @_;
         my $args = join ', ', @args;
-        print $self->debug_prefix, "Calling $method($args)\n";
+        $self->_debug_message("Calling $method($args)");
     };
 
     after $method => sub {
         my $self = shift;
-        print $self->debug_prefix, "Returning from $method\n";
+        $self->_debug_message("Returning from $method");
     };
 }