| Verby documentation | Contained in the Verby distribution. |
Verby::Action::BuildTool - Action to run 'perl Makefile.PL' or something similar in a specific directory.
use Verby::Action::MakefilePL;
This action runs something like 'perl Makefile.PL' (the script field) if the
target field (it's output file) seems out of date.
Run the script in the specified directory, using command.
Used by the Run role to improve the log messages.
Ensures that the target file exists next to the script file, and that is
as new or newer than script.
Defaults to $^X (the process used to invoke the currently running perl
program, probably "perl" or the shebang line).
Defaults to Makefile.PL.
Defaults to Makefile.
workdirThe directory in which to run the script.
additional_argsAn optional array ref for additional parameters to send to the script.
None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it.
We use Devel::Cover to test the code coverage of the tests, please refer to COVERAGE section of the Verby module for more information.
Yuval Kogman, <nothingmuch@woobling.org>
Copyright 2005-2008 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Verby documentation | Contained in the Verby distribution. |
#!/usr/bin/perl package Verby::Action::BuildTool; use Moose; with qw/Verby::Action::Run/; use File::Spec; use File::stat; has command => ( isa => "Str", is => "rw", default => $^X, ); has script => ( isa => "Str", is => "rw", default => "Makefile.PL", ); has target => ( isa => "Str", is => "rw", default => "Makefile", ); sub do { my ( $self, $c ) = @_; my $wd = $c->workdir || $c->logger->log_and_die(level => "error", message => "No working directory provided"); my @args = @{ $c->additional_args || [] }; $self->create_poe_session( c => $c, cli => [ $self->command, $self->script, @args ], init => sub { chdir $wd }, ); } sub finished { my ( $self, $c ) = @_; $self->confirm( $c ); } sub log_extra { my ( $self, $c ) = @_; " in " . $c->workdir; } sub verify { my ( $self, $c ) = @_; my $target = File::Spec->catfile($c->workdir, $self->target); my $script = File::Spec->catfile($c->workdir, $self->script); unless (-e $target) { $c->error("$target doesn't exist"); return; } unless ( stat($target)->mtime >= stat($script)->mtime ) { $c->error("$target is out of date"); return; } return 1; } __PACKAGE__ __END__