in reply to Re^2: A case where Mechanize works, LWP doesn't
in thread A case where Mechanize works, LWP doesn't

Why don't you just use WWW::Mechanize? It's based on LWP, so basically to make LWP::UserAgent behave like WWW::Mechanize means just taking the code of WWW::Mechanize.

  • Comment on Re^3: A case where Mechanize works, LWP doesn't

Replies are listed 'Best First'.
Re^4: A case where Mechanize works, LWP doesn't
by dneedles (Sexton) on Feb 10, 2010 at 19:56 UTC
    Great questions. The reason is two fold.

    1. Limit change. The existing PERL installation doesn't use Mechanize and I would rather not introduce it primarily to keep the politics under control.

    2. POE integration. I have seen much on LWP and POE but nothing on Mechanize and POE. I'd rather go with a more proven route.

    Correct me if I am wrong (with a URL, ISDN or other tangible reference) especially on #2

      As WWW::Mechanize ISA LWP::UserAgent, most of the techniques used to make LWP::UserAgent cooperate with POE will work with WWW::Mechanize as well.

        Ok. I wanted the luxury of being a bit lazy with a couple pre-chewed POE & Mechanize examples, but alas I want my autistic son to sleep more than an hour at a time and that ain't going to happen either. 8-) Thanks for the help. I am leaning toward the political fight as it seems Mechanize will lend to more rapid development and a more robust solution than via straight LWP.

      As a last resort, you could try LWP::Coro with POE (I'm not saying it works), or fork a separate process to do the downloading. Try that only if you really can't solve the original problem of doing the query without Mechanize, and if you really can't get rid of POE.

Re^4: A case where Mechanize works, LWP doesn't
by dneedles (Sexton) on Feb 11, 2010 at 13:51 UTC
    Actually found out this isn't the case. Mechanize has blocking calls. POE is more a cooperative scheduler along the lines of what Windows 3.1 was. So POE won't work well with Mechanize like it will with LWP. So I am back to using the sniffer to figure out how to code LWP with enough of Mechanize so the pages will return.