CUFP
beretboy
Despite my dislike of X10's evil marketing plots I caved and ended up picking up some X10 modules and an X10 Firecracker. For those of you who haven't seen the ads (consider yourself lucky) these little devices allow you to control lights and such from you computer. With the help of the wonderful <A HREF="http://mlug.missouri.edu/~tymm/">BottleRocket</A> utility
I hacked together two scripts which turn on a <A HREF="http://www.ikea.pl/IKEA2002/prod.xml?productId=90396860">funky little ikea light</A> when I have new mail. The first script checks to see if I have mail every minute or so and updates a website. The second script (which runs on my home machine) checks this site every now and then and turns the light on and off accoordingly. There are two scripts because my mail is on my hosting service's machine my lights are controlled by a machine in my house. Thus two scripts
<CODE>
#!/usr/bin/perl
use strict;
$/ = undef;
while (1) {
open(MAIL,"/var/mail/perlmonk");
my $mail = <MAIL>;
close(MAIL);
open(WEB,">/usr/home/perlmonk/public_html/mail");
if ($mail) {
print WEB "MAIL: YES\n";
} else {
print WEB "MAIL: NO\n";
}
close(WEB);
sleep(60);
}
</CODE>
<BR>
<CODE>
#!/usr/bin/perl
use strict;
use LWP::Simple qw( get );
while (1) {
my $mail = get("http://url.org/goes/here");
$mail =~ /MAIL: (YES|NO)/;
my $status = $1;
if ($status eq "YES") {
system("br a1 on");
} else {
system("br a1 off");
}
sleep(20);
}
</CODE>
<BR>
<BR>
"Sanity is the playground of the unimaginative"
-Unknown