scraping images with perl

I'm going to go through a simple image scraping program I conjured today. I wrote this to scrape images off a t-shirt gallery so that I could help my friend make a choice on his favourite one offline. \()/ Proud to be a nerd \()/

So for perl of course there already are modules on CPAN to help. I'm using two:

WWW:Mechanize [ This is a pretty famous module and can be used for some automation, downloading content from the web etc]

HTML::TokeParser [ We'll use this to parse the html and get to the tag we want. ]

My target html looked like this:

My "algorithm" went something like:

I used WWW::Mechanize::get() to get the page I wanted.

After this I supplied the page to Html::TokerParser.

From here I went looping through all the tags using the get_tag function till I found one with the gallery-img2 class.