in reply to Re: WWW-Search module that works
in thread WWW-Search module that works

i.e
#! 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...)

Replies are listed 'Best First'.
Re^3: WWW-Search module that works
by talexb (Chancellor) on Jun 12, 2007 at 14:18 UTC

    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

      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

        OK, but how about checking that you get a valid object back from the =new= constructor, and how about telling me what you see from within the debugger?

        Alex / talexb / Toronto

        "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        A reply falls below the community's threshold of quality. You may see it by logging in.

        I am using activeperl 5.86 so the she bang doesn't matter.

        Not true. ActivePerl reads the shebang line and processes the options found on it.