r72645 - in /branches/upstream/libwww-wikipedia-perl/current: Changes META.yml lib/WWW/Wikipedia.pm

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Fri Apr 15 20:55:15 UTC 2011


Author: carnil
Date: Fri Apr 15 20:55:05 2011
New Revision: 72645

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=72645
Log:
[svn-upgrade] new version libwww-wikipedia-perl (2.00)

Modified:
    branches/upstream/libwww-wikipedia-perl/current/Changes
    branches/upstream/libwww-wikipedia-perl/current/META.yml
    branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm

Modified: branches/upstream/libwww-wikipedia-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/Changes?rev=72645&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/Changes (original)
+++ branches/upstream/libwww-wikipedia-perl/current/Changes Fri Apr 15 20:55:05 2011
@@ -1,4 +1,9 @@
 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

Modified: branches/upstream/libwww-wikipedia-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/META.yml?rev=72645&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/META.yml (original)
+++ branches/upstream/libwww-wikipedia-perl/current/META.yml Fri Apr 15 20:55:05 2011
@@ -26,4 +26,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/edsu/www-wikipedia
-version: 1.99
+version: 2.00

Modified: branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm?rev=72645&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm (original)
+++ branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm Fri Apr 15 20:55:05 2011
@@ -8,7 +8,7 @@
 
 use base qw( LWP::UserAgent );
 
-our $VERSION = '1.99';
+our $VERSION = '2.00';
 
 use constant WIKIPEDIA_URL =>
     'http://%s.wikipedia.org/w/index.php?title=%s&action=raw';
@@ -148,19 +148,19 @@
 
     croak( "search() requires you pass in a string" ) if !defined( $string );
     
-    $string = utf8::is_utf8( $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(), $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 );
     }
@@ -187,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 );




More information about the Pkg-perl-cvs-commits mailing list