Subject: | get_friends repeatedly clicks 'Next' button; patch included |
Date: | Wed, 07 May 2008 23:33:05 +0100 |
To: | bug-www-myspace [...] rt.cpan.org |
From: | Steven Chamberlain <steven [...] pyro.eu.org> |
Hi,
The regex for detecting a 'Next' button no longer works properly with
the new friends lists. This led to get_friends repeatedly trying to
view many additional pages beyond the last one.
My attached patch seems to fix that, and has been tested with a full
'make test' (including all 'logged in' tests). The comments added in
the patch explain exactly what the problem was.
Regards,
--
Steven Chamberlain
steven@pyro.eu.org
Index: lib/WWW/Myspace.pm
===================================================================
--- lib/WWW/Myspace.pm (revision 578)
+++ lib/WWW/Myspace.pm (working copy)
@@ -6496,8 +6501,18 @@
$content = $self->current_page->decoded_content;
}
- $content =~ /">\s*Next\s*((<\/a>)?((\s| )+(\>|>))?|›\s*<\/a>)/io;
+ # Example HTML for 'Next' button in messaging inbox:
+ # <a class="pagingLink" href="javascript:__doPostBack('ctl00$ctl00$Main$messagingMain$MessageList$pagingTop','2')">Next ›</a>
+ #
+ # Example HTML for 'Next' button in friends list:
+ # <a href="javascript: GotoPage(6);" class="nextPagingLink">next</a>
+ #
+ # Example HTML for a *disabled* 'Next' button in friends list -- we do not
+ # want to match this:
+ # <a class="nextPagingLink disabledPaging">next</a>
+ $content =~ /<a [^>]*href=\"[^\"]*\"[^>]*>(\s| )*Next(\s| |›|>)*<\/a>/io;
+
}
=head2 _previous_button