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

Which function is used in WWW::Mechanize::Firefox to get the JSON and response values showing in firebug? $mech->res(); is not giving the same o/p as in firebug. For better understanding open any link say www.google.com in firefox and open your firebug too. Now search for anything and check the values in cosole. In console, you'll find response. I want that response part to be fetched through WWW::Mechanize::FIrefox.
#!perl -w use Data::Dumper; use MozRepl::RemoteObject; BEGIN { if( ! *MozRepl::RemoteObject::Methods::dive{ CODE } ) { *MozRepl::RemoteObject::Methods::dive = \&MozRepl::RemoteObjec +t::Instance::__dive; }; }; use WWW::Mechanize::Firefox; $mech = WWW::Mechanize::Firefox->new(); $mech->get('http://www.google.com/'); $mech->click(btnK); $hash = $mech->res(); print Dumper($hash);
P.S. : Marto, I',m not scrapping google, just taking an example to show where the problem lies.
  • Comment on Which function is used in WWW::Mechanize::Firefox to get the JSON and response values showing in firebug
  • Download Code

Replies are listed 'Best First'.
Re: Which function is used in WWW::Mechanize::Firefox to get the JSON and response values showing in firebug
by Corion (Patriarch) on May 17, 2012 at 14:04 UTC

    WWW::Mechanize::Firefox and Firebug are completely different. As you don't show any of the expected output you seem to see in Firebug, there is little to do to help you. Please take the time to work on your question skills.

    WWW::Mechanize::Firefox does not know abohut Firebug, so you will have to do the necessary legwork yourself.

    Update: Upon further reading, you seem to be very mistaken about the nature of the $res object. Using Data::Dumper will not work on it, or rather, will not return much information on it, as it is synthesized from the Javascript results. You will have to learn about Firefox and Javascript to make much sense of the results.

Re: Which function is used in WWW::Mechanize::Firefox to get the JSON and response values showing in firebug
by marto (Cardinal) on May 17, 2012 at 14:07 UTC

    Please don't replace questions entirely after you've posted them, simply edit the post and mark the updates.