#! Perl\bin\perl -w
use WWW::Search;
open FILE1, "> url1.txt" or die "$!";
my $oSearch = new WWW::Search('Yahoo::UK');
my $sQuery = WWW::Search::escape_query("world cup 2006");
$oSearch->native_query($sQuery);
while ( my $oResult = $oSearch->next_result() ) {
print "Adding: ", $oResult->url, "\n";
print FILE1 $oResult->url, "\n";
I am on activeperl 5.8X, it generates the url1.txt file but it is empty
Running this exact code (with or without strict and warnings enabled) with perl 5.8.4 on Linux works fine, it returns 10 URLs, both at the command line and in the file (WWW::Search version 2.46).
You could try using ethereal to view the traffic and see whether something is wrong there, or turn on the search_debug and search_parse_debug options in native_query.
close(FILE1);after you have finished writing to the file?
I'm not familiar with activeperl - but is there a chance it's not flushing the output to the file?
(Although I would *expect* Perl to cleanly flush to and then close the filehandle when the script ends!?)
coder45, taking a quick peek at the ppm commands yields the following results:
c:\>ppm help
Type 'help command' for more detailed help on a command.
Commands:
describe - describes packages in detail
exit - exits the program
help - prints this screen, or help on 'command'
install - installs packages
profiles - manage PPM profiles
properties - describes installed packages in detail
q - exits the program
query - queries installed packages
quit - exits the program
remove - uninstalls packages
repository - adds, removes, or sets repositories
s - searches for packages in a repository
search - searches for packages in a repository
settings - view or set PPM options
targets - views or sets target installer backends
tree - shows package dependency tree
uninstall - uninstalls packages
unset - view or set PPM options
upgrade - shows availables upgrades for installed packages
version - displays the PPM version (3.2)
Extra Help Topics: (not commands)
ppm_migration - guide for those familiar with PPM
prompt - how to interpret the PPM prompt
quickstart - a crash course in using PPM
unicode - notes about unicode author names
So you may want to give the following a try:
c:\>ppm upgrade WWW::Search
Update: Hmm, that won't help you out because it will query the activeperl repository. To re-install from Randy's repository, try the following:
c:\>ppm install http://theoryx5.uwinnipeg.ca/ppms/WWW-Search.ppd -forceNote the -force option which will reinstall the package if you already have it installed.
ppm> rep
Repositories:
[1] ActiveState Package Repository
[2] uwinnipeg
ppm> rep desc 2
Describing Active Repository 2:
Name: uwinnipeg
Location:
http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58
Type: PPMServer 2.0
ppm> upgrade -install WWW-Search-Yahoo
WWW-Search-Yahoo 2.37: new version 2.404 available
in uwinnipeg
====================
Upgrade 'WWW-Search-Yahoo' version 2.37
in ActivePerl 5.8.7.815.
====================
Downloaded 17256 bytes.
Extracting 17/17: blib/arch/auto/WWW/Search/Yahoo/.exists
Successfully upgraded WWW-Search-Yahoo version 2.37
in ActivePerl 5.8.7.815.
Thus, even though ppm saw that an upgraded version
was available in the uwinnipeg repository, it
didn't upgrade to that version. One way to do that
is to uninstall the package, move the uwinnipeg
repository ahead of the ActiveState repository, and
then install:
ppm> rep up 2
Repositories:
[1] uwinnipeg
[2] ActiveState Package Repository
ppm> remove WWW-Search-Yahoo
====================
Remove 'WWW-Search-Yahoo' version 2.37 from
ActivePerl 5.8.7.815.
====================
unlink C:\Perl\html\site\lib\WWW\Search\Yahoo.html
[ snip ]
ppm> install WWW-Search-Yahoo
====================
Install 'WWW-Search-Yahoo' version 2.404
in ActivePerl 5.8.7.815.
====================
Downloaded 22629 bytes.
Extracting 45/45: blib
Installing C:\Perl\html\site\lib\WWW\Search\Yahoo.html
[ snip ]
Successfully installed WWW-Search-Yahoo version 2.404
in ActivePerl 5.8.7.815.
ppm> upgrade WWW-Search-Yahoo
WWW-Search-Yahoo 2.404: up to date.
You should also do the same for the WWW-Search
package.
perlmonks.org content © perlmonks.org and coder45, randyk, serf, tirwhan, vek
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03