From: Jonathan Rockway Date: Mon, 13 Apr 2009 06:41:06 +0000 (-0500) Subject: add +Debug plugin (as an example) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Runnable.git;a=commitdiff_plain;h=098b6cb69271234876ad64da2737f0f4c98ed772 add +Debug plugin (as an example) --- diff --git a/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm b/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm new file mode 100644 index 0000000..60db341 --- /dev/null +++ b/lib/MooseX/Runnable/Invocation/Plugin/Debug.pm @@ -0,0 +1,21 @@ +package MooseX::Runnable::Invocation::Plugin::Debug; +use Moose::Role; +use Context::Preserve qw(preserve_context); + +for my $method (qw/load_class apply_scheme validate_class create_instance start_application/){ + + requires $method; + + before $method => sub { + my ($self, @args); + my $args = join ', ', @args; + print "Calling $method($args)\n"; + }; + + after $method => sub { + my ($next, $self, @args) = @_; + print "Returning from $method\n"; + }; +} + +1;