fraizerangus has asked for the wisdom of the Perl Monks concerning the following question:
I'm working with WWW::Mechanize, seems to be the right medicine for what I need but I've already hit a snag on the road; I'm only interested in following the 'motion.cgi' links and extracting these links as text documents however the regex I've used only finds the first 2 links? Anybody any ideas on whats going on?
best wishes#!/usr/bin/perl use strict; use WWW::Mechanize; use Storable; my $mech_cgi = WWW::Mechanize->new; $mech_cgi->get( 'http://www.molmovdb.org/cgi-bin/browse.cgi' ); my @cgi_links = $mech_cgi->find_all_links( url_regex => qr/motion.cgi? +/ ); for(my $i = 0; $i < @cgi_links; $i++) { print "following link: ", $cgi_links[$i]->url, "\n"; $mech_cgi->follow_link( url => $cgi_links[$i]->url ) or die "Error following link ", $cgi_links[$i]->url; }
Dan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW:Mechanize bug?
by jethro (Monsignor) on Oct 12, 2011 at 23:10 UTC | |
|
Re: WWW:Mechanize bug?
by Anonymous Monk on Oct 13, 2011 at 03:27 UTC | |
by fraizerangus (Sexton) on Oct 13, 2011 at 19:45 UTC | |
by Anonymous Monk on Oct 13, 2011 at 23:11 UTC |