Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

WWW::Mechanize error: Missing base argument at C:/Perl/lib/HTTP/Response.pm line 93

by ckj (Chaplain)
on Nov 06, 2012 at 07:58 UTC ( #1002428=perlquestion: print w/ replies, xml ) Need Help??
ckj has asked for the wisdom of the Perl Monks concerning the following question:

Hi M<onks, if any one can help me in this then it would be very great. my code is:
#!/usr/bin/perl use WWW::Mechanize; use warnings; my $mech = WWW::Mechanize->new(); my $mechx = WWW::Mechanize->new(autocheck => 0, autodie => 0); my $url = 'http://www.topbuy.com.au'; $mech->get($url); $content= $mech->content; if($content=~/id="topbuy-nav-category-wrapper">(.*?)id="topbuy-nav-fea +tures"/isxm){ $c = $1; @urls=''; while($c=~/href=(http.*?\.html)/gixsm){ $a_l = $1; if($a_l~~@urls){} else{push(@urls, "$a_l");} } } foreach $url (@urls) { continue_shopping($url); $mech->get($url) or die $!; $con1 = $mech->content(); $row = 0; while($con1 =~/<h5>(.*?)<\/h5>.*?"topbuy-subcategory">(.*?)<\/ul>/ +gisxm){ print "$1:$2\n"; } } sub continue_shopping{ my $a= shift; print $a; $mechx->get($a); $related = ''; $mechx->get("http://www.topbuy.com.au/avail/index/categorylv"); $txt = $mechx->content; while($txt=~/catalog\/product\/detail\/(.*?.jpg)/gisxm){ $related = $1.', '.$related; } print $related; }
UPDATE: I'm using perl 5.14 and HTTP::Response version is 6.01

But after running evrey time , I'm getting the error like: Missing base argument at C:/Perl/lib/HTTP/Response.pm line 93

I searched a lot for this and tried in that way too but it's giving the same error all the time.

Comment on WWW::Mechanize error: Missing base argument at C:/Perl/lib/HTTP/Response.pm line 93
Download Code
Replies are listed 'Oldest First'.
Re: WWW::Mechanize error: Missing base argument at C:/Perl/lib/HTTP/Response.pm line 93
by space_monk (Chaplain) on Nov 06, 2012 at 08:36 UTC
    Would probably help if you posted what version of PERL you were using and if possible what version of HTTP::Response (the version is at the top of C:/Perl/lib/HTTP/Response.pm).
Re: WWW::Mechanize error: Missing base argument at C:/Perl/lib/HTTP/Response.pm line 93
by Anonymous Monk on Nov 06, 2012 at 09:24 UTC
    Turn on $mech->show_progress(1); that way you have some content to start debuging with (like a url)
Re: WWW::Mechanize error: Missing base argument at C:/Perl/lib/HTTP/Response.pm line 93
by Anonymous Monk on Nov 06, 2012 at 09:30 UTC
    $ perl -MWWW::Mechanize -e " my $ua = WWW::Mechanize->new; $ua->get( u +ndef ) Missing base argument at C:/perl/site/5.14.1/lib/HTTP/Response.pm line + 93.
      Yep that would be my call as well; check that all the URLs that you are passing to the Mechanize::get method are properly defined.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1002428]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2015-07-07 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (92 votes), past polls