sub cwait()

in Misc.pm [31:46]


sub cwait
{
    my $condition = shift;
    my $wait = shift || 2;
    my $inc = shift || 50;
    my $timer = time() + $wait;
    while (! eval $condition) {
        usleep($inc);
        last if (time() >= $timer);
    }
    if ( eval $condition ) {
        return 1;
    } else {
        return 0;
    }
}