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 BottleRocket utility I hacked together two scripts which turn on a funky little ikea light 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
#!/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); }

#!/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); }


"Sanity is the playground of the unimaginative" -Unknown

In reply to Das Email Blinkenlight by beretboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.