r69026 - in /branches/upstream/libwww-wikipedia-perl/current: Changes META.yml Makefile.PL README 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:10:57 UTC 2011
Author: chrisb
Date: Sat Feb 19 01:10:44 2011
New Revision: 69026
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69026
Log:
[svn-upgrade] new version libwww-wikipedia-perl (1.99)
Modified:
branches/upstream/libwww-wikipedia-perl/current/Changes
branches/upstream/libwww-wikipedia-perl/current/META.yml
branches/upstream/libwww-wikipedia-perl/current/Makefile.PL
branches/upstream/libwww-wikipedia-perl/current/README
branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm
branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia/Entry.pm
branches/upstream/libwww-wikipedia-perl/current/t/15.entry.t
Modified: branches/upstream/libwww-wikipedia-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/Changes?rev=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/Changes (original)
+++ branches/upstream/libwww-wikipedia-perl/current/Changes Sat Feb 19 01:10:44 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: 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=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/META.yml (original)
+++ branches/upstream/libwww-wikipedia-perl/current/META.yml Sat Feb 19 01:10:44 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: branches/upstream/libwww-wikipedia-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/Makefile.PL?rev=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/Makefile.PL (original)
+++ branches/upstream/libwww-wikipedia-perl/current/Makefile.PL Sat Feb 19 01:10:44 2011
@@ -17,4 +17,6 @@
install_script 'bin/wikipedia';
+repository 'http://github.com/edsu/www-wikipedia';
+
WriteAll;
Modified: branches/upstream/libwww-wikipedia-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/README?rev=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/README (original)
+++ branches/upstream/libwww-wikipedia-perl/current/README Sat Feb 19 01:10:44 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: 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=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm (original)
+++ branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia.pm Sat Feb 19 01:10:44 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: branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia/Entry.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia/Entry.pm?rev=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia/Entry.pm (original)
+++ branches/upstream/libwww-wikipedia-perl/current/lib/WWW/Wikipedia/Entry.pm Sat Feb 19 01:10:44 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: branches/upstream/libwww-wikipedia-perl/current/t/15.entry.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-wikipedia-perl/current/t/15.entry.t?rev=69026&op=diff
==============================================================================
--- branches/upstream/libwww-wikipedia-perl/current/t/15.entry.t (original)
+++ branches/upstream/libwww-wikipedia-perl/current/t/15.entry.t Sat Feb 19 01:10:44 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