#! usr/bin/perl
use strict;
use warnings;
use WWW::Search;
my $oSearch = new WWW::Search('Yahoo::UK');
my $sQuery = WWW::Search::escape_query("spiderman 3 news");
$oSearch->native_query($sQuery);
while ( my $oResult = $oSearch->next_result() ) {
print "Adding: ", $oResult->url, "\n";
}
print ref($oSearch);
Shows nothing (the same with replacing Yahoo::UK with Altavista/Msn/Alltheweb...) | [reply] [d/l] |
OK .. now we're getting somewhere. You've provided some code (great) and told me it outputs nothing.
My tendency, whenever I create an object, is to make sure that the object is defined. So, in your example, I would check that $oSearch is defined after it's created, and die if not.
After that, I'd step through the program using the Perl debugger, and find out what's happening. Dump $sQuery and make sure it has something useful in it, and likewise, see what $oResult has.
Also, your shebang line is wrong. It should probably be
#!/usr/bin/perl -w
Try that out and let us know how it goes for you.
Alex / talexb / Toronto
"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds
| [reply] [d/l] [select] |
I am using activeperl 5.86 so the she bang doesn't matter.
The code is per the www-search-yahoo module.
I have tried it with many search terms and each show nothing.
I have updated to the most current version of www-search for each search engine listed, and the results are still the same where it is meant to print urls, it simply states for example WWW::Search::Yahoo repeatedly
| [reply] |