diff -Nru libwww-wikipedia-perl-1.98/Changes libwww-wikipedia-perl-2.00/Changes --- libwww-wikipedia-perl-1.98/Changes 2010-12-01 20:47:08.000000000 +0000 +++ libwww-wikipedia-perl-2.00/Changes 2011-04-05 12:41:04.000000000 +0000 @@ -1,5 +1,14 @@ Revision history for Perl extension WWW::Wikipedia. +2.00 Tue Apr 05 2011 + - use decoded_content() rather than just content() (RT #66337) + - parse raw text to get proper redirect link (RT #66337) + - try to catch self-redirects (RT #66337) + +1.99 Wed Feb 16 2011 + - Fix up title in entry and provide an accessor for the value + - use uri_escape_utf8 in search() as needed + 1.98 Wed Dec 01 2010 - Remove newline that was attached to redirects returned by search() diff -Nru libwww-wikipedia-perl-1.98/debian/changelog libwww-wikipedia-perl-2.00/debian/changelog --- libwww-wikipedia-perl-1.98/debian/changelog 2010-12-04 16:23:53.000000000 +0000 +++ libwww-wikipedia-perl-2.00/debian/changelog 2011-04-15 20:58:41.000000000 +0000 @@ -1,3 +1,20 @@ +libwww-wikipedia-perl (2.00-1) unstable; urgency=low + + * Team upload. + * New upstream release + * Bump Debhelper compat level to 8. + * debian/control: Bump versioned Build-Depends on debhelper to (>= 8). + + -- Salvatore Bonaccorso Fri, 15 Apr 2011 22:58:37 +0200 + +libwww-wikipedia-perl (1.99-1) unstable; urgency=low + + * New upstream release + * Updated years of copyright + * Add myself to Uploaders + + -- Chris Butler Sat, 19 Feb 2011 01:41:41 +0000 + libwww-wikipedia-perl (1.98-1) unstable; urgency=low * New upstream release. diff -Nru libwww-wikipedia-perl-1.98/debian/compat libwww-wikipedia-perl-2.00/debian/compat --- libwww-wikipedia-perl-1.98/debian/compat 2010-10-12 10:49:48.000000000 +0000 +++ libwww-wikipedia-perl-2.00/debian/compat 2011-04-15 20:55:53.000000000 +0000 @@ -1 +1 @@ -7 +8 diff -Nru libwww-wikipedia-perl-1.98/debian/control libwww-wikipedia-perl-2.00/debian/control --- libwww-wikipedia-perl-1.98/debian/control 2010-12-04 16:20:17.000000000 +0000 +++ libwww-wikipedia-perl-2.00/debian/control 2011-04-15 20:56:03.000000000 +0000 @@ -1,11 +1,12 @@ Source: libwww-wikipedia-perl Section: perl Priority: optional -Build-Depends: debhelper (>= 7.0.50) +Build-Depends: debhelper (>= 8) Build-Depends-Indep: perl, libwww-perl, liburi-perl, libtext-autoformat-perl, libtest-pod-perl, libtest-pod-coverage-perl Maintainer: Debian Perl Group Uploaders: Nathan Handler , - Ansgar Burchardt + Ansgar Burchardt , + Chris Butler Standards-Version: 3.9.1 Homepage: http://search.cpan.org/dist/WWW-Wikipedia/ Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libwww-wikipedia-perl/ diff -Nru libwww-wikipedia-perl-1.98/debian/copyright libwww-wikipedia-perl-2.00/debian/copyright --- libwww-wikipedia-perl-1.98/debian/copyright 2010-12-04 16:20:58.000000000 +0000 +++ libwww-wikipedia-perl-2.00/debian/copyright 2011-02-28 15:46:00.000000000 +0000 @@ -3,11 +3,13 @@ Source: http://search.cpan.org/dist/WWW-Wikipedia/ Name: WWW-Wikipedia -Copyright: 2003-2010, Ed Summers +Copyright: 2003-2011, Ed Summers License: Artistic or GPL-1+ Files: debian/* Copyright: 2009-2010, Nathan Handler + 2010, Ansgar Burchardt + 2011, Chris Butler License: Artistic or GPL-1+ Files: inc/Module/* @@ -25,7 +27,7 @@ License: GPL-1+ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by + it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. . diff -Nru libwww-wikipedia-perl-1.98/lib/WWW/Wikipedia/Entry.pm libwww-wikipedia-perl-2.00/lib/WWW/Wikipedia/Entry.pm --- libwww-wikipedia-perl-1.98/lib/WWW/Wikipedia/Entry.pm 2010-06-16 11:15:52.000000000 +0000 +++ libwww-wikipedia-perl-2.00/lib/WWW/Wikipedia/Entry.pm 2011-02-16 14:11:12.000000000 +0000 @@ -113,6 +113,18 @@ return $self->{ fulltext_basic }; } + +=head2 title() + +Returns a title of the entry. + +=cut + +sub title { + my $self = shift; + return $self->{ title }; +} + =head2 related() Returns a list of terms in the wikipedia that are mentioned in the @@ -196,11 +208,17 @@ my $src = $self->{ src }; # Add current language - my ( $lang ) = ( $src =~ /http:\/\/(..)/ ); + my ( $lang ) = ( $src =~ /http:\/\/(..)/ ); my $title = ( split( /\//, $src ) )[ -1 ]; + if( $title =~ m{\?title=} ) { + ( $title ) = $src =~ m{\?title=([^\&]+)}; + $title =~ s{_}{ }g; + } + $self->{ currentlang } = $lang; $self->{ languages }->{ $lang } = $title; + $self->{ title } = $title; for ( $self->{ cursor } = 0; @@ -298,7 +316,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright 2003-2010 by Ed Summers +Copyright 2003-2011 by Ed Summers This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libwww-wikipedia-perl-1.98/lib/WWW/Wikipedia.pm libwww-wikipedia-perl-2.00/lib/WWW/Wikipedia.pm --- libwww-wikipedia-perl-1.98/lib/WWW/Wikipedia.pm 2010-12-01 20:47:19.000000000 +0000 +++ libwww-wikipedia-perl-2.00/lib/WWW/Wikipedia.pm 2011-04-05 12:40:07.000000000 +0000 @@ -8,7 +8,7 @@ use base qw( LWP::UserAgent ); -our $VERSION = '1.98'; +our $VERSION = '2.00'; use constant WIKIPEDIA_URL => 'http://%s.wikipedia.org/w/index.php?title=%s&action=raw'; @@ -147,17 +147,20 @@ $self->error( undef ); croak( "search() requires you pass in a string" ) if !defined( $string ); - $string = URI::Escape::uri_escape( $string ); - my $src = sprintf( WIKIPEDIA_URL, $self->language(), $string ); + + my $enc_string = utf8::is_utf8( $string ) + ? URI::Escape::uri_escape_utf8( $string ) + : URI::Escape::uri_escape( $string ); + my $src = sprintf( WIKIPEDIA_URL, $self->language(), $enc_string ); my $response = $self->get( $src ); if ( $response->is_success() ) { - my $entry = WWW::Wikipedia::Entry->new( $response->content(), $src ); + my $entry = WWW::Wikipedia::Entry->new( $response->decoded_content(), $src ); # look for a wikipedia style redirect and process if necessary + # try to catch self-redirects return $self->search( $1 ) - if $self->follow_redirects - && $entry->text() =~ /^#REDIRECT ([^\r\n]+)/is; + if $self->follow_redirects && $entry->raw() =~ /^#REDIRECT \[\[([^|\]]+)/is && $1 ne $string; return ( $entry ); } @@ -184,7 +187,7 @@ my( $title ) = $response->request->uri =~ m{\.org/wiki/(.+)$}; $src = sprintf( WIKIPEDIA_URL, $self->language(), $title ); $response = $self->get( $src ); - return WWW::Wikipedia::Entry->new( $response->content(), $src ); + return WWW::Wikipedia::Entry->new( $response->decoded_content(), $src ); } $self->error( "uhoh, WWW::Wikipedia unable to contact " . $src ); @@ -234,7 +237,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright 2003-2010 by Ed Summers +Copyright 2003-2011 by Ed Summers This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libwww-wikipedia-perl-1.98/Makefile.PL libwww-wikipedia-perl-2.00/Makefile.PL --- libwww-wikipedia-perl-1.98/Makefile.PL 2010-06-16 11:18:56.000000000 +0000 +++ libwww-wikipedia-perl-2.00/Makefile.PL 2011-02-16 14:11:58.000000000 +0000 @@ -17,4 +17,6 @@ install_script 'bin/wikipedia'; +repository 'http://github.com/edsu/www-wikipedia'; + WriteAll; diff -Nru libwww-wikipedia-perl-1.98/META.yml libwww-wikipedia-perl-2.00/META.yml --- libwww-wikipedia-perl-1.98/META.yml 2010-12-01 21:01:40.000000000 +0000 +++ libwww-wikipedia-perl-2.00/META.yml 2011-04-05 12:42:39.000000000 +0000 @@ -25,4 +25,5 @@ perl: 5.6.0 resources: license: http://dev.perl.org/licenses/ -version: 1.98 + repository: http://github.com/edsu/www-wikipedia +version: 2.00 diff -Nru libwww-wikipedia-perl-1.98/README libwww-wikipedia-perl-2.00/README --- libwww-wikipedia-perl-1.98/README 2010-12-01 21:01:40.000000000 +0000 +++ libwww-wikipedia-perl-2.00/README 2011-04-05 12:42:38.000000000 +0000 @@ -99,7 +99,7 @@ Brian Cassidy COPYRIGHT AND LICENSE - Copyright 2003-2010 by Ed Summers + Copyright 2003-2011 by Ed Summers This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libwww-wikipedia-perl-1.98/t/15.entry.t libwww-wikipedia-perl-2.00/t/15.entry.t --- libwww-wikipedia-perl-1.98/t/15.entry.t 2009-09-14 12:56:10.000000000 +0000 +++ libwww-wikipedia-perl-2.00/t/15.entry.t 2011-02-16 14:04:57.000000000 +0000 @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 16; use_ok( 'WWW::Wikipedia::Entry' ); @@ -23,8 +23,8 @@ is( $categories[ 0 ], "Programming languages", 'categories()' ); is( $entry->related(), 91, 'related()' ); - is( $entry->raw(), $wikitext, 'raw()' ); +is( $entry->title(), 'Perl', 'title()' ); ## test spanish text $wikitext = getWikiText( 'perl.es.raw' ); @@ -37,6 +37,7 @@ is( $categories[ 0 ], "Lenguajes interpretados", 'categories()' ); is( $entry->related(), 36, 'related()' ); is( $entry->raw(), $wikitext, 'raw()' ); +is( $entry->title(), 'Perl', 'title()' ); ## fetches some wikitext from disk sub getWikiText {