Archer::Plugin::Confirm - Archer::Plugin::Confirm documentation


Archer documentation Contained in the Archer distribution.

Index


Code Index:

NAME

Top

Archer::Plugin::Confirm -

SYNOPSIS

Top

  - module: Confirm
    config:
      msg: really deploy? [Y/N]

DESCRIPTION

Top

really deploy?

AUTHORS

Top

Tokuhiro Matsuno.


Archer documentation Contained in the Archer distribution.

package Archer::Plugin::Confirm;
use strict;
use warnings;
use base qw/Archer::Plugin/;
use IO::Prompt;

sub run {
    my ($self,) = @_;

    local $SIG{ALRM} = sub {
        $self->detach("\n\nConfirm timeout\n");
    };

    my $msg = $self->{config}->{msg} || 'do ? [y/n]';
    my $timeout = $self->{config}->{timeout} || 0;
    my $latest_alarm = alarm $timeout;

    if ( IO::Prompt::prompt( $msg, '-yn' ) ) {
        alarm $latest_alarm;
        $self->log(debug => "yes");
    }
    else {
        $self->log(debug => "no");
        $self->detach("cancel'd by user");
    }
}

1;
__END__