Skip Menu |

This queue is for tickets about the WWW-Wikipedia CPAN distribution.

Report information
The Basics
Id: 66337
Status: resolved
Priority: 0/
Queue: WWW-Wikipedia

People
Owner: Nobody in particular
Requestors: ASP [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.99
Fixed in: (no value)



Hi Below are 2 bugs that I had found in the lastest version of WWW::Wikipedia The use of ->decoded_content instead of ->content is just the preferred approach for LWP::UserAgent Also you can find the fix for both bugs attached #### Code to reporduce the problem 1 #### -> returns undef perl -MWWW::Wikipedia -MData::Dumper -e 'my $wiki = WWW::Wikipedia->new( language => "en" ); $wiki->follow_redirects( 1 ); print Dumper($wiki->search( "Parabat" ) );' #### Code to reporduce the problem 2 #### -> deep recursion on subroutine perl -MWWW::Wikipedia -MData::Dumper -e 'my $wiki = WWW::Wikipedia->new( language => "en" ); $wiki->follow_redirects( 1 ); print Dumper($wiki->search( "Unplugged_II" ) );' WWW-Wikipedia-1.99 Kind Regards, Sorin Pop 158c158 < my $entry = WWW::Wikipedia::Entry->new( $response->content(), $src ); --- Show quoted text
> my $entry = WWW::Wikipedia::Entry->new(
$response->decoded_content(), $src ); 163c163 < && $entry->text() =~ /^#REDIRECT ([^\r\n]+)/is; --- Show quoted text
> && $entry->text() =~ /^#REDIRECT (.+?)\r?\n?/is;
Subject: decoded_content() and #REDIRECT parsing
Hi Sorin, Thanks for your patches. I've applied them with some variation: 1) I've also added decoded_content() in the random() method. 2) I've changed to parsing the raw text to find #REDIRECT links. If you wish to try out these changes, please checkout the source from github: https://github.com/edsu/www-wikipedia Thanks.
Hi Brian, Really sorry for the late response but I had a lot of stuff going on. I tested your version and it seems to be really good. Hoping for a quick release so I can install it on all my computers. Thanks
Also I think you need to add another check when doing the redirects so that the current link does not link to itself (like: Zagorsk-2_Pumped_Storage_Station ) right now it links to itself
I've tried to catch self-redirects by checking if the search string matches the redirect text. This seems to work for your example. Version 2.00 has been released to CPAN. Please file a new ticket for any additional issues you find. Thanks for your help! -Brian