#!/usr/bin/perl
#
# Chris Van Hoof <vanhoof@redhat.com>
# $Id$
#

use strict;

print "Starting $0"."\n\n";

my $time_counter = 0;
my $time_total = 60;
my $time_to_wait = 60;

sleep($time_to_wait);

while ($time_counter <= $time_total) {
	$time_counter++;
	my $time_left = ($time_total-$time_counter);

	time_to_drink();
	
	if ($time_counter == '1') {
		print $time_counter." minute passed... ".$time_left." to go!"."\n\n";
	} else {
		print $time_counter." minutes passed... ".$time_left." to go!"."\n\n";
	}

	my $second_counter = '0';

	do {
		$|++;

		if ($second_counter == $time_to_wait) {
			print $second_counter."\n";
		} else {
			print $second_counter.'->';
		}

		$|--;

		sleep(1);
	
		$second_counter++;

	} while ($second_counter <= $time_to_wait);

}  

print "$0 Finished..."."\n";

sub time_to_drink {
	print "\a\a\a";
	return 0;
}
