| Archer documentation | Contained in the Archer distribution. |
Archer::Plugin::Confirm -
- module: Confirm
config:
msg: really deploy? [Y/N]
really deploy?
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__