Skip Menu |

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

Report information
The Basics
Id: 288
Status: resolved
Worked: 5 min
Priority: 0/
Queue: WWW-Automate

People
Owner: Nobody in particular
Requestors: briac [...] cpan.org
Cc:
AdminCc:

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



Subject: Making extract_links follow frames
I just wrote this patch a couple of days ago for my version of WWW::Chat, and I think it could be also useful for WWW::Automate. The patch gives the user the opportunity to follow frames as if they were regular links. The 'name' attribute replace the content of the <a> element, and the url is given by the frame 'src' attribute.
--- Automate.pm Wed Feb 13 18:52:57 2002 +++ Automate.pm.frame Thu Feb 14 20:56:05 2002 @@ -348,11 +348,12 @@ my $p = HTML::TokeParser->new(\$self->{content}); my @links; - while (my $token = $p->get_tag("a")) { - my $url = $token->[1]{href}; - next unless defined $url; # probably just a name link - my $text = $p->get_trimmed_text("/a"); - push(@links, [$url => $text]); + while (my $token = $p->get_tag("a", "frame")) { + my $url = $token->[0] eq 'a' ? $token->[1]{href} : $token->[1]{src}; + next unless defined $url; # probably just a name link + my $text = $token->[0] eq 'a' ? + $p->get_trimmed_text("/a"):$token->[1]{name}; + push(@links, [$url => $text]); } return \@links; }
Thanks, applied ;)