1 package MooseX::Runnable::Invocation::Plugin::Debug;
4 with 'MooseX::Runnable::Invocation::Plugin::Role::CmdlineArgs';
6 # this is an example to cargo-cult, rather than a useful feature :)
7 has 'debug_prefix' => (
11 default => sub { "" },
14 sub _build_initargs_from_cmdline {
15 my ($class, @args) = @_;
16 confess 'Bad args passed to Debug plugin'
17 unless @args % 2 == 0;
21 if(my $p = $args{'--prefix'}){
22 return { debug_prefix => $p };
28 my ($self, @msg) = @_;
29 print {*STDERR} $self->debug_prefix, "[$$] ", @msg, "\n";
33 load_class apply_scheme validate_class
34 create_instance start_application
38 before $method => sub {
39 my ($self, @args) = @_;
40 my $args = join ', ', @args;
41 $self->_debug_message("Calling $method($args)");
44 after $method => sub {
46 $self->_debug_message("Returning from $method");