--#--
I, Robot
--#--
According to brain researcher
Steven Pinker,
we won't see robots that mimic human behavior for a very
long time to come. Fortunately for those of us who use robots,
most of human behavior would be undesirable in anything other than
a human, anyway.
While we wait for the Real Magilla to come along, we can amuse ourselves
with simple robots to perform truly useful tasks. For instance, suppose you
use a domain-redirection service to map a cool site name to your dynamic
IP address. (If you're not already doing this,
here's
an explanation of what it is and how to do it.)
Mapping a static host name to your ever-changing IP address is a really
cool idea. But what a drag to have to go to the mapping site every
time you get connected and type in your new IP, etc.
Wouldn't it be great to have a robot that visits the redirection
service's Web site everytime your IP changes, and update your record?
Easy. Here's how:
I've used TSX to map my Web site to
http://macondo.tsx.org, but there are others, like DHS (run by former
staffers at monolith.org). Whichever, the technique is fairly much the same.
Perl is the language of choice for this task, because the helpful members of
the Perl community have given us two powerful libraries that make it easy:
LWP.pm and HTTP.pm. Using these two, we can build our robot in about 40
lines of Perl.
We'll start our first step by determining what our IP address is after
we've connected to our ISP.