coder45 has asked for the wisdom of the Perl Monks concerning the following question:

if I wanted to follow an image tag with this html:
alt="testing" align="middle" /></a></span></td>
and this url: http://...testing.php?mode=test& if I was using the mechanize module, would $agent->follow_link(( url_regex => qr/testing/i ); or $agent->follow_link(( text_regex => qr/testing/i ); work?

Edit: g0n - code tags

Replies are listed 'Best First'.
Re: following an alt image
by Fletch (Bishop) on Jan 14, 2006 at 22:43 UTC

    Erm, the alt attribute is a description, not a URI.

    <!ELEMENT IMG - O EMPTY -- Embedded image --> <!ATTLIST IMG %attrs; -- %coreattrs, %i18n, %events - +- src %URI; #REQUIRED -- URI of image to embed -- alt %Text; #REQUIRED -- short description -- longdesc %URI; #IMPLIED -- link to long description (complements alt) -- name CDATA #IMPLIED -- name of image for scripting +-- height %Length; #IMPLIED -- override height -- width %Length; #IMPLIED -- override width -- usemap %URI; #IMPLIED -- use client-side image map -- ismap (ismap) #IMPLIED -- use server-side image map -- >

    There's no reason to expect it's something that can be "followed".

Re: following an alt image
by superfrink (Curate) on Jan 15, 2006 at 05:41 UTC
    As Fletch pointed out the alt value contains a description. This is used by web-browsers that are not able to display images such as lynx.

    For example the image code on my web-site:

    <img alt="[SuperFrinkLogo]" src="sf_logo.gif">

    shows up as [SuperFrinkLogo] when viewed using lynx.

    Update: added HTML code.