#!/usr/bin/perl -w
# NAME: wait_key.pl
# AIM: Just a test of wait_key...
use strict;
use warnings;
## use Term::TermKey; - NOT available

sub prt($) { print shift; }

sub get_stdin($) {
    my ($rc) = shift;
    ${$rc} = <STDIN>;
}

sub wait_key_input($) {
    my ($msg) = shift;
    if (length($msg)) {
        prt($msg);
    }
    my $char = '';
    get_stdin(\$char);
    if ($char =~ /^y/i) {
        return 1;
    }
    return 0;
}

prt("Wait key test... NOTE: An ENTER key is required to terminate the input!\n");

if (wait_key_input("Enter 'y' to continue : ")) {
    prt("Got 'y'... continuing...\n");
} else {
    prt("Did not get 'y' - Abort\n");
}

# eof - wait_key.pl
