[libwww-search-perl] 06/11: Update WWW::Search::Lycos to 2.225
Nick Morrott
nickm-guest at moszumanska.debian.org
Fri Jul 29 01:45:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
nickm-guest pushed a commit to branch master
in repository libwww-search-perl.
commit 4a66e592dfd37847b2c87a61a3ea6cec8faefe51
Author: Nick Morrott <knowledgejunkie at gmail.com>
Date: Tue Jul 26 13:32:17 2016 +0100
Update WWW::Search::Lycos to 2.225
---
lycos/{ChangeLog => Changes} | 6 +++
lycos/MANIFEST | 5 +-
lycos/META.yml | 4 +-
lycos/MYMETA.json | 50 --------------------
lycos/MYMETA.yml | 28 -----------
lycos/README.md | 2 +
lycos/inc/Module/Install.pm | 22 +++++----
lycos/inc/Module/Install/Base.pm | 2 +-
lycos/inc/Module/Install/Can.pm | 2 +-
lycos/inc/Module/Install/Fetch.pm | 2 +-
lycos/inc/Module/Install/Makefile.pm | 4 +-
lycos/inc/Module/Install/Metadata.pm | 6 +--
lycos/inc/Module/Install/Win32.pm | 2 +-
lycos/inc/Module/Install/WriteAll.pm | 2 +-
lycos/lib/WWW/Search/Lycos.pm | 92 +++++++++++++++++-------------------
lycos/t/basic.t | 31 +++++-------
16 files changed, 91 insertions(+), 169 deletions(-)
diff --git a/lycos/ChangeLog b/lycos/Changes
similarity index 94%
rename from lycos/ChangeLog
rename to lycos/Changes
index 47c7db0..df3dcff 100644
--- a/lycos/ChangeLog
+++ b/lycos/Changes
@@ -1,3 +1,9 @@
+2016-02-06 Kingpin <martin at localhost.localdomain>
+
+ * t/basic.t: updated tests
+
+ * lib/WWW/Search/Lycos.pm (_parse_tree): fixed parser for current HTML
+
2004-01-17 Kingpin <mthurn at verizon.net>
* Lycos.pm (parse_tree): parse size and date for each result; gui_query() is the only query we do now
diff --git a/lycos/MANIFEST b/lycos/MANIFEST
index bc6b451..2085ec0 100644
--- a/lycos/MANIFEST
+++ b/lycos/MANIFEST
@@ -1,4 +1,4 @@
-ChangeLog
+Changes
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
@@ -12,7 +12,6 @@ LICENSE
Makefile.PL
MANIFEST This list of files
META.yml
-MYMETA.json
-MYMETA.yml
README
+README.md
t/basic.t
diff --git a/lycos/META.yml b/lycos/META.yml
index 3d2fc59..c5009cd 100644
--- a/lycos/META.yml
+++ b/lycos/META.yml
@@ -10,7 +10,7 @@ configure_requires:
ExtUtils::MakeMaker: 6.36
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.06'
+generated_by: 'Module::Install version 1.16'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,4 +27,4 @@ requires:
perl: 5.004
resources:
license: http://dev.perl.org/licenses/
-version: 2.224
+version: '2.225'
diff --git a/lycos/MYMETA.json b/lycos/MYMETA.json
deleted file mode 100644
index 31178aa..0000000
--- a/lycos/MYMETA.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "abstract" : "class for searching www.lycos.com",
- "author" : [
- "As of 1998-12-07, C<WWW::Search::Lycos> is maintained by Martin Thurn",
- "Martin Thurn <mthurn at cpan.org>"
- ],
- "dynamic_config" : 0,
- "generated_by" : "Module::Install version 1.06, CPAN::Meta::Converter version 2.120921",
- "license" : [
- "perl_5"
- ],
- "meta-spec" : {
- "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
- },
- "name" : "WWW-Search-Lycos",
- "no_index" : {
- "directory" : [
- "inc",
- "t"
- ]
- },
- "prereqs" : {
- "build" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "6.36",
- "Test::More" : "0"
- }
- },
- "configure" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "6.36"
- }
- },
- "runtime" : {
- "requires" : {
- "HTML::TreeBuilder" : "0",
- "WWW::Search::Test" : "2.21"
- }
- }
- },
- "release_status" : "stable",
- "resources" : {
- "license" : [
- "http://dev.perl.org/licenses/"
- ]
- },
- "version" : "2.223",
- "x_module_name" : "WWW::Search::Lycos"
-}
diff --git a/lycos/MYMETA.yml b/lycos/MYMETA.yml
deleted file mode 100644
index e04c21a..0000000
--- a/lycos/MYMETA.yml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-abstract: 'class for searching www.lycos.com'
-author:
- - 'As of 1998-12-07, C<WWW::Search::Lycos> is maintained by Martin Thurn'
- - 'Martin Thurn <mthurn at cpan.org>'
-build_requires:
- ExtUtils::MakeMaker: 6.36
- Test::More: 0
-configure_requires:
- ExtUtils::MakeMaker: 6.36
-dynamic_config: 0
-generated_by: 'Module::Install version 1.06, CPAN::Meta::Converter version 2.120921'
-license: perl
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
-name: WWW-Search-Lycos
-no_index:
- directory:
- - inc
- - t
-requires:
- HTML::TreeBuilder: 0
- WWW::Search::Test: 2.21
-resources:
- license: http://dev.perl.org/licenses/
-version: 2.223
-x_module_name: WWW::Search::Lycos
diff --git a/lycos/README.md b/lycos/README.md
new file mode 100644
index 0000000..2e16559
--- /dev/null
+++ b/lycos/README.md
@@ -0,0 +1,2 @@
+# WWW-Search-Lycos
+Perl module distribution WWW::Search::Lycos
diff --git a/lycos/inc/Module/Install.pm b/lycos/inc/Module/Install.pm
index 4ecf46b..f44ab4d 100644
--- a/lycos/inc/Module/Install.pm
+++ b/lycos/inc/Module/Install.pm
@@ -17,7 +17,7 @@ package Module::Install;
# 3. The ./inc/ version of Module::Install loads
# }
-use 5.005;
+use 5.006;
use strict 'vars';
use Cwd ();
use File::Find ();
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.06';
+ $VERSION = '1.16';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -156,10 +156,10 @@ END_DIE
sub autoload {
my $self = shift;
my $who = $self->_caller;
- my $cwd = Cwd::cwd();
+ my $cwd = Cwd::getcwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
- my $pwd = Cwd::cwd();
+ my $pwd = Cwd::getcwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
@@ -239,7 +239,7 @@ sub new {
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
- unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
+ unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) {
delete $args{prefix};
}
return $args{_self} if $args{_self};
@@ -338,7 +338,7 @@ sub find_extensions {
if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
my $content = Module::Install::_read($subpath . '.pm');
my $in_pod = 0;
- foreach ( split //, $content ) {
+ foreach ( split /\n/, $content ) {
$in_pod = 1 if /^=\w/;
$in_pod = 0 if /^=cut/;
next if ($in_pod || /^=cut/); # skip pod text
@@ -378,6 +378,7 @@ eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _read {
local *FH;
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
+ binmode FH;
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
@@ -386,6 +387,7 @@ END_NEW
sub _read {
local *FH;
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
+ binmode FH;
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
return $string;
@@ -416,6 +418,7 @@ eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _write {
local *FH;
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
+ binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
@@ -425,6 +428,7 @@ END_NEW
sub _write {
local *FH;
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
@@ -434,7 +438,7 @@ END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
-sub _version ($) {
+sub _version {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
@@ -450,12 +454,12 @@ sub _version ($) {
return $l + 0;
}
-sub _cmp ($$) {
+sub _cmp {
_version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
-sub _CLASS ($) {
+sub _CLASS {
(
defined $_[0]
and
diff --git a/lycos/inc/Module/Install/Base.pm b/lycos/inc/Module/Install/Base.pm
index 802844a..5762a74 100644
--- a/lycos/inc/Module/Install/Base.pm
+++ b/lycos/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
}
# Suspend handler for "redefined" warnings
diff --git a/lycos/inc/Module/Install/Can.pm b/lycos/inc/Module/Install/Can.pm
index 22167b8..d859276 100644
--- a/lycos/inc/Module/Install/Can.pm
+++ b/lycos/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/lycos/inc/Module/Install/Fetch.pm b/lycos/inc/Module/Install/Fetch.pm
index bee0c4f..41d3517 100644
--- a/lycos/inc/Module/Install/Fetch.pm
+++ b/lycos/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/lycos/inc/Module/Install/Makefile.pm b/lycos/inc/Module/Install/Makefile.pm
index 7052f36..e9918d2 100644
--- a/lycos/inc/Module/Install/Makefile.pm
+++ b/lycos/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -133,7 +133,7 @@ sub makemaker_args {
return $args;
}
-# For mm args that take multiple space-seperated args,
+# For mm args that take multiple space-separated args,
# append an argument to the current list.
sub makemaker_append {
my $self = shift;
diff --git a/lycos/inc/Module/Install/Metadata.pm b/lycos/inc/Module/Install/Metadata.pm
index 58430f3..9792685 100644
--- a/lycos/inc/Module/Install/Metadata.pm
+++ b/lycos/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -347,7 +347,7 @@ sub name_from {
^ \s*
package \s*
([\w:]+)
- \s* ;
+ [\s|;]*
/ixms
) {
my ($name, $module_name) = ($1, $1);
@@ -705,7 +705,7 @@ sub _write_mymeta_data {
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
- # Overwrite the non-configure dependency hashs
+ # Overwrite the non-configure dependency hashes
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
diff --git a/lycos/inc/Module/Install/Win32.pm b/lycos/inc/Module/Install/Win32.pm
index eeaa3fe..218a66b 100644
--- a/lycos/inc/Module/Install/Win32.pm
+++ b/lycos/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/lycos/inc/Module/Install/WriteAll.pm b/lycos/inc/Module/Install/WriteAll.pm
index 85d8018..530749b 100644
--- a/lycos/inc/Module/Install/WriteAll.pm
+++ b/lycos/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.16';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/lycos/lib/WWW/Search/Lycos.pm b/lycos/lib/WWW/Search/Lycos.pm
index f0a4776..a377c0f 100644
--- a/lycos/lib/WWW/Search/Lycos.pm
+++ b/lycos/lib/WWW/Search/Lycos.pm
@@ -1,7 +1,7 @@
# Lycos.pm
# by Wm. L. Scheding and Martin Thurn
# Copyright (C) 1996-1998 by USC/ISI
-# $Id: Lycos.pm,v 2.224 2013/03/17 13:18:25 martin Exp $
+# $Id: Lycos.pm,v 2.223 2008/12/15 22:47:13 Martin Exp $
=head1 NAME
@@ -69,7 +69,7 @@ use strict;
use warnings;
my
-$VERSION = do { my @r = (q$Revision: 2.224 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
+$VERSION = 2.225;
our $MAINTAINER = 'Martin Thurn <mthurn at cpan.org>';
use Carp;
@@ -77,6 +77,18 @@ use URI::Escape;
use base 'WWW::Search';
use WWW::Search::Result;
+sub gui_query
+ {
+ my $self = shift;
+ my $sQuery = shift;
+ $self->{_options} = {
+ search_url => q{http://search.lycos.com/},
+ query => $sQuery,
+ };
+ return $self->native_query(@_);
+ } # gui_query
+
+
sub native_setup_search
{
my ($self, $native_query, $native_options_ref) = @_;
@@ -95,11 +107,12 @@ sub native_setup_search
if (! defined($self->{_options}))
{
- # As of 2013: http://search.lycos.com/web?q=yoda
$self->{'search_base_url'} = 'http://search.lycos.com';
$self->{_options} = {
- 'search_url' => $self->{'search_base_url'} .'/web',
+ 'search_url' => $self->{'search_base_url'} .'/web/',
'q' => $native_query,
+ # 'loc' => 'searchbox',
+ # 'tab' => 'web',
};
} # if
@@ -141,67 +154,52 @@ sub _parse_tree
{
my $self = shift;
my $oTree = shift;
+ warn " DDD start Lycos::_parse_tree()\n" if (3 <= $self->{_debug});
my $hits_found = 0;
- if (! $self->approximate_result_count)
+ unless ($self->approximate_result_count)
{
my $oTITLE = $oTree->look_down(
- _tag => 'h2',
- # class => 'ltGry',
+ _tag => 'div',
+ class => 'search-numbers',
);
if (ref $oTITLE)
{
- my $sRC = $oTITLE->as_text;
- print STDERR " + RC == $sRC\n" if 2 <= $self->{_debug};
- if ($sRC =~ m!\s*\d+\s+thru\s+\d+\s+of\s+([0-9,]+)\b!i)
+ my $sRC = $oTITLE->parent->as_text;
+ warn " DDD RC == $sRC\n" if 2 <= $self->{_debug};
+ if ($sRC =~ m!\b([0-9,]+)\s*results\b!i)
{
my $sCount = $1;
- print STDERR " + raw count == $sCount\n" if 3 <= $self->{_debug};
+ warn " DDD raw count == $sCount\n" if 3 <= $self->{_debug};
$sCount =~ s!,!!g;
- print STDERR " + cooked count == $sCount\n" if 3 <= $self->{_debug};
+ warn " DDD cooked count == $sCount\n" if 3 <= $self->{_debug};
$self->approximate_result_count($sCount);
} # if
} # if
- } # if
+ } # unless
my ($sURL, $sTitle, $sDesc);
my $sScore = '';
my $sSize = '';
my $sDate = '';
- my @aoIS = $oTree->look_down(_tag => 'div',
- class => 'resultText',
+ my @aoIS = $oTree->look_down(_tag => 'h2',
+ class => 'result-title',
);
IS_TAG:
foreach my $oIS (@aoIS)
{
- next IS_TAG if ! ref $oIS;
+ next IS_TAG unless ref $oIS;
warn " DDD oIS is ===". $oIS->as_HTML ."===\n" if 2 <= $self->{_debug};
- my $oTitle = $oIS->look_down(_tag => 'h4');
- if (! ref $oTitle)
- {
- warn " EEE no child <h4> element\n" if 2 <= $self->{_debug};
- next IS_TAG;
- } # if
- my $sTitle = $oTitle->as_text;
- my $oURL = $oIS->look_down(_tag => 'p',
- class => 'baseURL',
- );
- if (! ref $oURL)
- {
- warn " EEE no child <p baseURL> element\n" if 2 <= $self->{_debug};
- next IS_TAG;
- } # if
- $oURL->detach;
- $oURL->delete;
- my $oDesc = $oIS->look_down(_tag => 'p');
- if (! ref $oDesc)
- {
- warn " EEE no child <p> element\n" if 2 <= $self->{_debug};
- next IS_TAG;
- } # if
- my $sDesc = $oDesc->as_text;
- print STDERR " + found desc ===$sDesc===\n" if 2 <= $self->{_debug};
- my $oParent = $oIS->parent;
- warn " DDD oParent is ===". $oParent->as_HTML ."===\n" if 2 <= $self->{_debug};
- my $sURL = $oParent->attr('title');
+ my $sTitle = $oIS->as_text;
+
+ my $oTDhit = $oIS->parent;
+ next IS_TAG unless ref $oTDhit;
+ warn " DDD oTDhit is ===". $oTDhit->as_HTML ."===\n" if 2 <= $self->{_debug};
+ my $oSPAN = $oTDhit->look_down(_tag => 'span',
+ class => 'result-url');
+ my $sURL = 'http://'. $oSPAN->as_text;
+ $oSPAN = $oTDhit->look_down(_tag => 'span',
+ class => 'result-description');
+ my $sDesc = $oSPAN->as_text;
+ warn " DDD found desc ===$sDesc===\n" if 2 <= $self->{_debug};
my $hit = new WWW::Search::Result;
$hit->add_url($sURL);
@@ -213,15 +211,13 @@ sub _parse_tree
} # foreach $oB
# Find the next link, if any:
my @aoA = $oTree->look_down(_tag => 'a',
- title => 'Next',
- # sub { $_[0]->as_text eq 'Next >' },
- );
+ sub { $_[0]->as_text eq 'Next' } );
A_TAG:
# We want the last "next" link on the page:
my $oA = $aoA[-1];
if (ref $oA)
{
- print STDERR " + oAnext is ===", $oA->as_HTML, "===\n" if 2 <= $self->{_debug};
+ warn " DDD oAnext is ===", $oA->as_HTML, "===\n" if 2 <= $self->{_debug};
$self->{_next_url} = $self->absurl($self->{'_prev_url'}, $oA->attr('href'));
} # if
SKIP_NEXT_LINK:
diff --git a/lycos/t/basic.t b/lycos/t/basic.t
index b6b8e23..8b7af8e 100644
--- a/lycos/t/basic.t
+++ b/lycos/t/basic.t
@@ -1,16 +1,10 @@
-# $Id: basic.t,v 1.12 2013/03/17 13:18:29 martin Exp $
+# $Id: basic.t,v 1.11 2008/12/14 23:59:46 Martin Exp $
-use warnings;
-use strict;
-
-use constant DEBUG_CONTENTS => 0;
-
-use blib;
use ExtUtils::testlib;
-use Test::More 'no_plan';
-use WWW::Search::Test;
+use Test::More no_plan;
+use WWW::Search::Test;
BEGIN
{
use_ok('WWW::Search::Lycos');
@@ -22,20 +16,18 @@ my $iDebug = 0;
my $iDump = 0;
my @ao;
-goto CONTENTS if DEBUG_CONTENTS;
+# goto TEST_NOW; # for debugging
# This test returns no results (but we should not get an HTTP error):
diag("Sending bogus query to lycos.com...");
-tm_run_test('normal', 'asdfjkersladfkse;oirjsdlkfjleijladsjflkjelrfkilj', 0, 0, $iDebug);
+tm_run_test('normal', qq{"$WWW::Search::Test::bogus_query"}, 0, 0, $iDebug);
-CONTENTS:
+TEST_NOW:
pass;
-diag("Sending query to lycos.com...");
-$iDebug = DEBUG_CONTENTS ? 2 : 0;
+diag("Sending 1-page query to lycos.com...");
+$iDebug = 0;
$iDump = 0;
-# It's almost impossible for a query to return only one page of
-# results, because of auto-generated results
-tm_run_test('normal', 'dumblesnor'.'ifically', 1, 9, $iDebug, $iDump);
+tm_run_test('normal', 'establishmentarianistic'.'ally', 1, 9, $iDebug, $iDump);
# Look at some actual results:
@ao = $WWW::Search::Test::oSearch->results();
cmp_ok(0, '<', scalar(@ao), 'got any results');
@@ -50,7 +42,8 @@ foreach my $oResult (@ao)
'result description is not empty');
} # foreach
-goto ALL_DONE if DEBUG_CONTENTS;
+# goto ALL_DONE; # for debugging
+
diag("Sending multi-page query to lycos.com...");
$iDebug = 0;
$iDump = 0;
@@ -58,6 +51,6 @@ tm_run_test('normal', 'the lovely Britney Spears', 21, undef, $iDebug, $iDump);
ALL_DONE:
pass;
+exit 0;
__END__
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libwww-search-perl.git
More information about the Pkg-perl-cvs-commits
mailing list