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

Hello Monks! I am trying to retrieve the html of a specific div in my perl script after WWW::Mechanize call. This is the code I am using:
use WWW::Mechanize; $mech->get ("$url"); print Dumper $mech->content(); #This prints everything, I only want t +he div with id '#div_id_test'
How can I do that? I tried to use selector method of WWW::Mechanize::Plugin::Selector:
use WWW::Mechanize::Plugin::Selector; $mech->selector('#div_id_test');
but it keeps telling me Can't locate object method "selector" via package "WWW::Mechanize" !

Any thoughts?

Replies are listed 'Best First'.
Re: use selector method with WWW::Mechanize
by Corion (Patriarch) on Nov 18, 2015 at 15:40 UTC

    Although the name is quite suggestive, WWW::Mechanize::Plugin::Selector does not plug into WWW::Mechanize.

    I recommend instead taking the code from the source of that module and using that source code directly.