You could write a plugin for WWW::Mechanize::Pluggable to handle this; you'd of course need to specify the frame you wanted to navigate into, but it's definitely possible. You could save the name of the frame in a get() prehook, do the get, and then follow_link() in a get() posthook to fetch the frame contents, returning that as the content. Since the follow_link happens in the posthook, your mainline code does something like
$mech->get($the_frame_link, frame=>$subframe_name);
and all the work happens under the covers. If you're going to need to do complex nested-frame navigation, you'd need a more refined interface to describe the frame nesting, but this'd do for what you've described. There are a number of plugins available on CPAN (in the Mech::Plugin namespace) as study aids in figuring out how to do this.
Disclaimer: I wrote Mech::Pluggable, but it just makes extending Mech a little bit in any particular direction a lot easier to do. | [reply] [d/l] |