#!/usr/bin/env perl # # FILE: naptime.pl # AUTHOR: Paul Gorman (pgorman@hartmantyner.com) # # This Perl script is a simple alarm clock. The only argument is the number of # seconds to sleep. When time expires, a little tune plays through the PC # speaker until the process is killed. # use Audio::Beep; if ( (@ARGV != 1) or ($ARGV[0] =~ /\D/) ) { print("USAGE: alarmclock 1800 [i.e.--number of seconds to sleep]\n"); } else { $duration = $ARGV[0]; sleep($duration); my $beeper = Audio::Beep->new(); print("WAKE UP!\n"); while (1) { $beeper->play("g' f bes' c8 f d4 c8 f d4 bes c g f2 "); } }