#!/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__ =pod =head1 NAME Verby::Action::BuildTool - Action to run 'perl Makefile.PL' or something similar in a specific directory. =head1 SYNOPSIS use Verby::Action::MakefilePL; =head1 DESCRIPTION This action runs something like 'perl Makefile.PL' (the C