[Chicago-talk] Please allow me to introduce myself

Andy_Bach at wiwb.uscourts.gov Andy_Bach at wiwb.uscourts.gov
Thu Mar 18 15:46:03 CST 2004


Acme::Playmate

I was just curious what it was, as I only read the articles.  Hmm, seems 
to work too, except for that BirthDate problem:
#!/usr/bin/perl -w
use strict;
use Acme::Playmate;

            my $playmate = new Acme::Playmate("2003", "04");

            print "Details for playmate " . $playmate->{ "Name" } . "\n";
            print "Birthdate" . $playmate->{ "BirthDate" } . "\n";
            print "Birthplace" . $playmate->{ "BirthPlace" } . "\n";
            print "Bust" . $playmate->{ "Bust" } . "\n";
            print "Waist" . $playmate->{ "Waist" } . "\n";
            print "Hips" . $playmate->{ "Hips" } . "\n";
            print "Height" . $playmate->{ "Height" } . "\n";
            print "Weight" . $playmate->{ "Weight" } . "\n";


$ playmate.pl
Details for playmate Carmella Danielle DeCesare
BirthdateCarmella Danielle DeCesare
Birthplace Avon Lake, Ohio
Bust 34"  B
Waist  24"
Hips 27"
Height  5' 8"
Weight 118 lbs

The data:
    <td class="bodytext" valign="top">
                <!-- -------------- PLAYMATE DATASHEET -------------- -->
                <p><b>BIRTHPLACE:</b> Avon Lake, Ohio  </p>
                <p><b>BUST:</b> 34"&nbsp; B  </p>
                <p><b>WAIST:</b>  24"</p>
                <p><b>HIPS:</b> 27"</p>
                <p><b>HEIGHT:</b>  5' 8"</p>
                <p><b>WEIGHT:</b>118 lbs </p>
                <!-- datasheet -->

The code:
        my $con = $res->content;
print $con;
        $con =~ s/[\r\n]//g;
        $con =~ s/&nbsp;/ /g;
        $con =~ /.*?<span class="name">(.*?)<\/span>.*?/is;
        my $name = $1;
        $con =~ /.*?<p><b>BIRTHDATE:<\/b>(.*?)<\/p>.*?/is;
        my $birthDate = $1;
        $con =~ /.*?<p><b>BIRTHPLACE:<\/b>(.*?)<\/p>.*?/is;

and the problem???  failure to check for a match, so you get the last one.

a

Andy Bach, Sys. Mangler
Internet: andy_bach at wiwb.uscourts.gov 
VOICE: (608) 261-5738  FAX 264-5030

"Civilization advances by extending the number of important operations 
&which we can perform without thinking." Alfred North Whitehead




More information about the Chicago-talk mailing list