Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 2973
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: Greg.Davies [...] lhsc.on.ca
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Date: Thu, 17 Jul 2003 10:32:02 -0400
From: "Greg Davies" <Greg.Davies [...] lhsc.on.ca>
To: <bug-WWW-Mechanize [...] rt.cpan.org>
Subject: follow_link parm combining
Andy, First of all, thanks for a fantastic module! I'd like to be able to combine the text and url_regex parms in a follow_link in much the way that you allow the combining of text and n. I'm parsing news.google searches and want to follow "Next" links when they exist. My concern is that "Next" may be the full text of a link to a news item as well as a the text of the link to the next page of search results. So, I tried this: last unless $google->follow_link( text => "Next", url_regex => qr/^\/news/ ); Unfortunately, the url_regex match seems to take precedence over the text match (or get || with it) and I get endless links. I was hoping that the parms would &&. Obviously I can code around this, but I thought I'd offer it as a suggestion. Thanks for your time, Greg Davies
[Greg.Davies@lhsc.on.ca - Thu Jul 17 10:32:22 2003]: Show quoted text
> I'd like to be able to combine the text and url_regex parms in a > follow_link in much the way that you allow the combining of text and n. > > I'm parsing news.google searches and want to follow "Next" links when > they exist. My concern is that "Next" may be the full text of a link to > a news item as well as a the text of the link to the next page of search > results. So, I tried this: > > last unless $google->follow_link( text => "Next", url_regex => > qr/^\/news/ ); > > Unfortunately, the url_regex match seems to take precedence over the > text match (or get || with it) and I get endless links. I was hoping > that the parms would &&. > > Obviously I can code around this, but I thought I'd offer it as a > suggestion.
I think using url_regex is a bad idea in any case, since when you are browsing you don't really look at the urls, do you? (maybe sometimes) I think is a much better idea to follow the "Next" link after the "Result Page:" if that exists.
Following based on the URL is absolutely necessary sometimes...
Your wish is my command. It's in 0.54, which I'm going to release in a few minutes...