in reply to Re: www::mechanize returning a page to a particular frame
in thread www::mechanize returning a page to a particular frame

ok, thanks. I was wondering whether it could be done directly without using  follow_link.
Obviously not, nevermind.
Thanks again

Replies are listed 'Best First'.
Re^3: www::mechanize returning a page to a particular frame
by pemungkah (Priest) on Jan 20, 2007 at 01:00 UTC
    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.