1 package MooseX::Runnable::Invocation::Plugin::Debug;
2 # ABSTRACT: print debugging information
6 with 'MooseX::Runnable::Invocation::Plugin::Role::CmdlineArgs';
8 # this is an example to cargo-cult, rather than a useful feature :)
9 has 'debug_prefix' => (
13 default => sub { "" },
16 sub _build_initargs_from_cmdline {
17 my ($class, @args) = @_;
18 confess 'Bad args passed to Debug plugin'
19 unless @args % 2 == 0;
23 if(my $p = $args{'--prefix'}){
24 return { debug_prefix => $p };
30 my ($self, @msg) = @_;
31 print {*STDERR} $self->debug_prefix, "[$$] ", @msg, "\n";
35 load_class apply_scheme validate_class
36 create_instance start_application
40 before $method => sub {
41 my ($self, @args) = @_;
42 my $args = join ', ', @args;
43 $self->_debug_message("Calling $method($args)");
46 after $method => sub {
48 $self->_debug_message("Returning from $method");
60 This is an example plugin, showing how you could write your own. It
61 prints a message for each stage of the "run" process. It is also used
62 by other plugins to determine whether or not to print debugging