From: | "Potozniak, Andrew" <acp7 [...] citmail.buffalo.edu> |
To: | "'bug-www-mechanize [...] rt.cpan.org'" <bug-www-mechanize [...] rt.cpan.org> |
Subject: | Mechanize::links (Suggestion) |
Date: | Mon, 28 Jul 2003 13:37:09 -0400 |
(HTML CODE SNIPPET)
<MAP NAME="SOME_MAP">
<AREA HREF="SOME_URL" CORDS="X,Y,L,W">
</MAP>
<IMG SRC="SOME_IMAGE" USEMAP="#SOME_MAP">
(SUGGESTION)
I would like to see a subroutine in Mechanize that will take the <AREA
HREF=""> tags inside of an image map and extract them like Mechanize::links
does to a <A HREF=SOMEURL></A> tag.
For example:
On www.potozniak.org/perl <http://www.potozniak.org/perl> I have an image
map on the bottom of my page which allows for easy navigation to major parts
of my site (most of the links are not functional yet.) I would like to be
able to iterate over all my links (<A HREF> and <AREA HREF> tags) to "crawl"
through my site completely.
(POSSIBLE IMPLEMENTATION OF SUGGESTION)
I propose to either add <AREA HREF> links to what the Mechanize::links
subroutine returns OR create a new subroutine that would get the <AREA HREF>
links and return them in the same manner as Mechanize::links does. The
advantage to the later is that you could build a subroutine that calls both
Mechanize::a_href_links and Mechanize::image_map_links and returns an array
like Mechanize::links does. (i.e.)
(SUB FUNCTIONS WITH COMMENTS ABOUT IMPLEMENTATION)
sub links{
#calls both a_href_links and image_map_links, combines the arrays and
returns them
}
sub a_href_links{
#this does exactly what Mechanize::links does at the
current implementation of Mechanize
}
sub image_map_links{
#this will do what Mechanize::links does at the current implementation
of Mechanize but
#it will get the links from the AREA HREF tags instead of A HREF tags
}
The design is ultimately up to you :-D
---------------------------------------------------
Andrew Potozniak
Administrative Computing
Student Assistant
State University of New York at Buffalo
acp7@citmail.buffalo.edu <mailto:acp7@citmail.buffalo.edu>
645-3587 x 7123
http://www.potozniak.org <http://www.potozniak.org>
---------------------------------------------------