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

Hi all,
I am trying to store a Win32::IE::Mechanize object and then use it later, but I am not able to do so. I don't know what the problem is.. I tried dumping the Win32::IE::Mechanize Object using Data::Dumper, but I find that almost all the data is undef or null.. Please suggest me as to how to save the Win32::IE::Mechanize object and use it later..
use Win32::IE::Mechanize; use Data::Dumper; $ie = Win32::IE::Mechanize->new(visibile=>1); $ie->get('http://google.com'); sleep(4); print Dumper($ie);
This gives an output like
$VAR1 = bless( { 'quiet' => undef, 'images' => undef, 'headers' => {}, '_opt' => { 'visible' => 1 }, 'forms' => undef, 'onwarn' => undef, 'onerror' => undef, 'agent' => bless( {}, 'Win32::OLE' ), 'cur_form' => undef, 'links' => undef, 'basic_authentication' => {} }, 'Win32::IE::Mechanize' );

Replies are listed 'Best First'.
Re: How to persist Win32::IE::Mechanize object
by Corion (Patriarch) on Aug 08, 2008 at 13:06 UTC

    Win32::IE::Mechanize is based on Win32::OLE, and an OLE object lives in another process entirely. So you cannot persist Win32::IE::Mechanize objects. The best thing you can try is to save all "necessary" information, like page history etc., and then recreate that to restore the object.

      Oh... Bad. :( Thanks for the reply though..
      Is there any other way by which I can work on an IE window that I have opened already?? I tried GetActiveObject option, but it is not working, it opens up a new IE always.
      Or use some other modules to do this operation???

      Thanks,
      Monkster
        Maybe its a new window, buts its the same process (see task manager).