Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Negate link search in Mechanize

by Plankton (Priest)
on Nov 02, 2011 at 05:04 UTC ( #935293=note: print w/ replies, xml ) Need Help??


in reply to Negate link search in Mechanize

Why not just get all the links like so ...

... use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get( $url ); my @links = $mech->links();
... then iterate over @links. Something like ...
for my $l (@links) { next if $l->url() =~ /foo/; push ( @non_foo_links, $l ); ...


Comment on Re: Negate link search in Mechanize
Select or Download Code
Re^2: Negate link search in Mechanize
by Anonymous Monk on Nov 02, 2011 at 05:18 UTC
    Why not just get all the links like so ...

    Because I'm lazy (a Perl virtue, you know). But thanks, I was too focused on letting Mechanize do the work and did overlook the obvious. Maybe time to get some sleep.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2015-07-07 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls