Commits

Shlomi Fish committed 111c423

$pagination_div can be undef.

  • Participants
  • Parent commits 2bcefb0

Comments (0)

Files changed (2)

modules/WWW-Search-MSN/Changes

 Revision history for WWW-Search-MSN
 
+0.0106
+        - Making sure we do the right thing, when a possibly non-existent 
+        element was not found and as a result was assigned undef.
+            - Fixes https://rt.cpan.org/Ticket/Display.html?id=43339
+
 0.0105  Thu Nov 27 21:29:46 IST 2008
         - Updated to the new MSN Search syntax.
 

modules/WWW-Search-MSN/lib/WWW/Search/MSN.pm

 
     # Get the next URL
     {
-        my $pagination_div = $tree->look_down("_tag", "div", "class", "sb_pag");
-        my ($a_tag) = $pagination_div->look_down("_tag", "a", "class", "sb_pagN");
+        my $pagination_div =
+            $tree->look_down("_tag", "div", "class", "sb_pag");
+        if ($pagination_div)
+        {
+            my ($a_tag) = $pagination_div->look_down(
+                "_tag", "a", "class", "sb_pagN"
+            );
 
-        if ($a_tag)
-        {
-            $self->{'_next_url'} =
-                $self->absurl(
-                        $self->{'_prev_url'},
-                        $a_tag->attr('href')
-                    );
+            if ($a_tag)
+            {
+                $self->{'_next_url'} =
+                    $self->absurl(
+                            $self->{'_prev_url'},
+                            $a_tag->attr('href')
+                        );
+            }
         }
     }
     return $hits_found;