From: Jonathan Rockway Date: Thu, 25 Jun 2009 21:42:08 +0000 (-0700) Subject: add prototype Profile plugin X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d068787919a9e1a12181cab62e7db915818b9ffd;p=gitmo%2FMooseX-Runnable.git add prototype Profile plugin --- diff --git a/lib/MooseX/Runnable/Invocation/Plugin/Profile.pm b/lib/MooseX/Runnable/Invocation/Plugin/Profile.pm new file mode 100644 index 0000000..28a4cc1 --- /dev/null +++ b/lib/MooseX/Runnable/Invocation/Plugin/Profile.pm @@ -0,0 +1,21 @@ +package MooseX::Runnable::Invocation::Plugin::Profile; +use Moose::Role; + +before 'load_class' => sub { + my ($self) = @_; + confess 'The Profile plugin cannot be used when not invoked via mx-urn' + unless $self->does('MooseX::Runnable::Invocation::Role::WithParsedArgs'); + + my @cmdline = $self->parsed_args->guess_cmdline( + perl_flags => ['-d:NYTProf'], + without_plugins => ['Profile', '+'.__PACKAGE__], + ); + + eval { $self->_debug_message( + "Re-execing with ". join ' ' , @cmdline, + )}; + + exec(@cmdline); +}; + +1;