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

I cannot confirm the code works for me, because I don't have that module installed. But I don't *have* to have that module installed to be able to explain to you how to get started, using code from the module's own POS.

Perlmonks is all about helping someone reasonably computer literate get through some of the bumpier parts of the language and/or the community, assuming a decent amount of effort on the part of the initiate.

This is by now my fourth reply to your original query, and I've spent some time trying to help you. All you need to do is put the code into a script, run it with perl -d yourScriptHere.pl, step through a few lines (n for next), and dump the value of some variables (x $yourVariable), and, based on those results, move forward with your learning.

Or someone else will pick up this particular falling torch ..

Alex / talexb / Toronto

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

Replies are listed 'Best First'.
Re^10: WWW-Search module that works
by coder57 (Novice) on Jun 14, 2007 at 15:46 UTC
    so far :
    C:\Perl\bin>perl -d ysam5a.pl Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. main::(ysam5a.pl:7): my $sUser; DB<1> x $sUser 0 undef DB<2> n main::(ysam5a.pl:8): my $sPassword; DB<2> x $sPassword 0 undef DB<3> n main::(ysam5a.pl:10): my $sQuery = 'Columbus Ohio sushi restaurant'; DB<3> x my $sQuery 0 undef DB<4>
    The exact code is:
    #!/usr/bin/perl use strict; use warnings; use WWW::Search; my $sUser; my $sPassword; my $sQuery = 'Columbus Ohio sushi restaurant'; my $oSearch = new WWW::Search('AltaVista'); $oSearch->native_query(WWW::Search::escape_query($sQuery)); $oSearch->login($sUser, $sPassword); while (my $oResult = $oSearch->next_result()) { print $oResult->url, "\n"; } # while $oSearch->logout;
    Pls if you could install the module and verify for yourself, because I am not the only one who says it no longer works.

      Great! You're in the debugger. Except all you've done is dump the results of three my statements -- which doesn't help us understand why the module isn't working.

      Keep going (no one said this stuff is easy) and step a few more times, and check that you get a good object from the new constructor (as I've said twice before). Continue stepping, letting us know what's going on inside the while loop.

        Pls if you could install the module and verify for yourself, because I am not the only one who says it no longer works.

      I could give you all sorts of reasons why I shouldn't do this, but I'm not going to -- in any case, you're running on Windows/DOS, and I'm on RH9, so the result would be meaningless. The point is, you have to be the one who figures out what's going on. All I can do here is offer assistance, and try to keep from snapping (reminds me of raising teenagers, in a way).

      Alex / talexb / Toronto

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

      The line of code displayed by the debugger is the line it's about to execute, not the line it just executed. Hit 'n' one more time, then x my $sQuery, and you should see the value you assigned to $sQuery.
        so far
        DB<1> n main::(ysam5a.pl:10): my $sQuery = 'Columbus Ohio sushi restaurant'; DB<1> n main::(ysam5a.pl:11): my $oSearch = new WWW::Search('AltaVista'); DB<1> x $sQuery 0 'Columbus Ohio sushi restaurant' DB<2> n main::(ysam5a.pl:13): $oSearch->native_query(WWW::Search::escape_que +ry($sQuer )); DB<2> x my $oSearch 0 undef DB<3> n main::(ysam5a.pl:14): $oSearch->login($sUser, $sPassword); DB<3> n main::(ysam5a.pl:16): while (my $oResult = $oSearch->next_result()) main::(ysam5a.pl:17): { DB<3> n main::(ysam5a.pl:20): $oSearch->logout; DB<3> x my $oResult 0 undef DB<4> n Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info.