r69028 - in /trunk/libwww-wikipedia-perl: Changes META.yml Makefile.PL README debian/changelog lib/WWW/Wikipedia.pm lib/WWW/Wikipedia/Entry.pm t/15.entry.t

chrisb at users.alioth.debian.org chrisb at users.alioth.debian.org
Sat Feb 19 01:16:19 UTC 2011


Author: chrisb
Date: Sat Feb 19 01:15:50 2011
New Revision: 69028

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69028
Log:
New upstream release

Modified:
    trunk/libwww-wikipedia-perl/Changes
    trunk/libwww-wikipedia-perl/META.yml
    trunk/libwww-wikipedia-perl/Makefile.PL
    trunk/libwww-wikipedia-perl/README
    trunk/libwww-wikipedia-perl/debian/changelog
    trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia.pm
    trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia/Entry.pm
    trunk/libwww-wikipedia-perl/t/15.entry.t

Modified: trunk/libwww-wikipedia-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/Changes?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/Changes (original)
+++ trunk/libwww-wikipedia-perl/Changes Sat Feb 19 01:15:50 2011
@@ -1,4 +1,8 @@
 Revision history for Perl extension WWW::Wikipedia.
+
+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()

Modified: trunk/libwww-wikipedia-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/META.yml?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/META.yml (original)
+++ trunk/libwww-wikipedia-perl/META.yml Sat Feb 19 01:15:50 2011
@@ -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: 1.99

Modified: trunk/libwww-wikipedia-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/Makefile.PL?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/Makefile.PL (original)
+++ trunk/libwww-wikipedia-perl/Makefile.PL Sat Feb 19 01:15:50 2011
@@ -17,4 +17,6 @@
 
 install_script 'bin/wikipedia';
 
+repository 'http://github.com/edsu/www-wikipedia';
+
 WriteAll;

Modified: trunk/libwww-wikipedia-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/README?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/README (original)
+++ trunk/libwww-wikipedia-perl/README Sat Feb 19 01:15:50 2011
@@ -99,7 +99,7 @@
     Brian Cassidy <bricas at cpan.org>
 
 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.

Modified: trunk/libwww-wikipedia-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/debian/changelog?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/debian/changelog (original)
+++ trunk/libwww-wikipedia-perl/debian/changelog Sat Feb 19 01:15:50 2011
@@ -1,3 +1,9 @@
+libwww-wikipedia-perl (1.99-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Chris Butler <chrisb at debian.org>  Sat, 19 Feb 2011 01:11:24 +0000
+
 libwww-wikipedia-perl (1.98-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia.pm?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia.pm (original)
+++ trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia.pm Sat Feb 19 01:15:50 2011
@@ -8,7 +8,7 @@
 
 use base qw( LWP::UserAgent );
 
-our $VERSION = '1.98';
+our $VERSION = '1.99';
 
 use constant WIKIPEDIA_URL =>
     'http://%s.wikipedia.org/w/index.php?title=%s&action=raw';
@@ -147,7 +147,10 @@
     $self->error( undef );
 
     croak( "search() requires you pass in a string" ) if !defined( $string );
-    $string = URI::Escape::uri_escape( $string );
+    
+    $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 $response = $self->get( $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. 

Modified: trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia/Entry.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia/Entry.pm?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia/Entry.pm (original)
+++ trunk/libwww-wikipedia-perl/lib/WWW/Wikipedia/Entry.pm Sat Feb 19 01:15:50 2011
@@ -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. 

Modified: trunk/libwww-wikipedia-perl/t/15.entry.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-wikipedia-perl/t/15.entry.t?rev=69028&op=diff
==============================================================================
--- trunk/libwww-wikipedia-perl/t/15.entry.t (original)
+++ trunk/libwww-wikipedia-perl/t/15.entry.t Sat Feb 19 01:15:50 2011
@@ -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 {




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