SPUG: RE: Hosting SPUG meetings

William Julien moonbeam at catmanor.com
Thu Oct 14 21:44:56 CDT 1999


>
>We could determine the geographic center for all 278 people
>on the SPUG mailing list that provides equal driving distance
>for all -- Hmmmmm, that might place us in Lake Washington! Plus
>this might be more than we care to have to calculate and folks
>would have to be honest about their driving distances, right?
>
Hmmm... We could do that in perl! First use the DBI module to read
a spug database of all it's members and for each address form a maps.yahoo.com
"Get Directions" html query. Then we use the LWP module to GET each of these
pages and parse the html source with a regex looking for /\d+.\.?\d+ miles/
and /\d+ mins/. (pardon if my regex is not quite right, I am regex challanged)

I don't have LWP installed on my computer at home, and my consultix class
notes are at work, so the LWP get exercise will be left to the reader. The
DBI stuff is not rocket science.

But here is some code to format the query...


#!/usr/local/bin/perl -w
#
$newaddr = "213 222nd ave ne";
$newcsz= "Redmond, WA 98053";
$newtaddr = "1100 Fairview Ave. N";
$newtcsz = "Seattle, WA 98109";
#
$newaddr =~ s/\ /+/g;
$newcsz =~ s/\ /+/g;
$newtaddr =~ s/\ /+/g;
$newtcsz =~ s/\ /+/g;

$url = "http://maps.yahoo.com/py/ddResults.py?Pyt=Tmap&doit=1&newname=&newdesc=&newaddr=$newaddr&newcsz=$newcsz&newtcsz=$newtcsz&Get Directions=Get+Directions";
print "$url\n";

looks like a fun project!

        _,'|            _.-''``-...___..--';
       /, \'.      _..-' ,      ,--...--'''
      < \   .`--'''      `     /| William Julien moonbeam at catmanor.com
       `-,;'              ;   ; ; http://www.catmanor.com/moonbeam/
 __...--''     __...--_..'  .;.'  vi is my shepherd; i shall not font.
(,__....----'''      (,..--''     
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list