view PokeScrape.pl @ 2:d7dd496a4fa6 boosterpack

[svn r4] actual functionality!
author robert
date Tue, 08 Sep 2009 02:45:26 -0400
parents 477258d09353
children 2e849c856026
line wrap: on
line source
1 use Card;
2 use Storable;
4 open POKE, "<all.dat";
6 @allcards = ();
9 for $line(<POKE>)
10 {
11 $line =~ m/(<img.*?>).*?(<img.*?>).*?/;
13 $img1 = $1;
14 $img3 = $2;
15 $line =~ m/(<a.*?<\/a>).*?/;
16 $img2 = $1;
19 #<img src="/cdexdata/images/types/w.gif" alt="Water" title="Water" height="17" width="17" class="t">
21 #<a id="base-set-2-blastoise" href="/scans/base-set/2-blastoise.jpg" title="Blastoise from Base Set (#2)" target="1">Blastoise</a>
23 #<img src="/cdexdata/images/rarities/rare-holo.gif" alt="Rare Holo" title="Rare Holo" width="28" height="16">
28 $img1 =~ m/alt="(.*?)"/;
29 $typeTag = $1;
31 $img2 =~ m/\(\#(\d+)\)/;
32 $numTag = $1;
33 $img2 =~ m/href="(.*?)"/;
34 $pix = $1;
35 $img2 =~ m/>(.*)</;
36 $nameTag = $1;
37 $img2 =~ m/from (.*?) \(/;
38 $setTag = $1;
40 $img3 =~ m/alt="(.*?)"/;
41 $rarityTag = $1;
44 if ($line =~ m/^<td/)
45 {
46 print $numTag," ",$nameTag;
47 $tempCard = Card->new();
48 $tempCard->addTags($typeTag,$numTag,$nameTag,$setTag,$rarityTag);
49 $tempCard->setPix($pix);
50 print " $setTag \n";
51 push @allcards,$tempCard;
54 }
58 }
61 store \@allcards, 'CARD.perl';
65 my $refnewstruct = retrieve 'CARD.perl';
68 print @$refnewstruct[0]->getTags();