[Bps-public-commit] r18291 - in Net-Google-Code/branches/write: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Feb 9 06:55:08 EST 2009


Author: sunnavy
Date: Mon Feb  9 06:54:51 2009
New Revision: 18291

Modified:
   Net-Google-Code/branches/write/   (props changed)
   Net-Google-Code/branches/write/lib/Net/Google/Code/Downloads.pm
   Net-Google-Code/branches/write/lib/Net/Google/Code/Home.pm
   Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm
   Net-Google-Code/branches/write/lib/Net/Google/Code/IssueSearch.pm
   Net-Google-Code/branches/write/lib/Net/Google/Code/WikiEntry.pm

Log:
 r19705 at sunnavys-mb:  sunnavy | 2009-02-09 17:05:15 +0800
 use HTMLTree role


Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/Downloads.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/Downloads.pm	(original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/Downloads.pm	Mon Feb  9 06:54:51 2009
@@ -44,8 +44,7 @@
     my $content =
       $self->fetch( $self->base_url . "downloads/detail?name=$filename" );
 	
-	require HTML::TreeBuilder;
-    my $tree = HTML::TreeBuilder->new;
+    my $tree = $self->html_tree;
     $tree->parse_content($content);
     $tree->elementify;
     

Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/Home.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/Home.pm	(original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/Home.pm	Mon Feb  9 06:54:51 2009
@@ -26,8 +26,7 @@
         
         my $html = $self->__html;
         
-        require HTML::TreeBuilder;
-        my $tree = HTML::TreeBuilder->new;
+        my $tree = $self->html_tree;
         $tree->parse_content($html);
         $tree->elementify;
         

Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm	(original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/Issue.pm	Mon Feb  9 06:54:51 2009
@@ -48,8 +48,7 @@
     my $self    = shift;
     my $content = shift;
 
-    require HTML::TreeBuilder;
-    my $tree = HTML::TreeBuilder->new;
+    my $tree = $self->html_tree;
     $tree->parse_content($content);
     $tree->elementify;
 
@@ -149,6 +148,7 @@
               qw/comment summary status owner merge_into cc blocked_on/,
         }
     );
+
     # convert hash to array. e.g. Type => Defect to Type-Defect
     if ( $args{label} && ref $args{label} eq 'HASH' ) {
         $args{label} =
@@ -168,17 +168,11 @@
         }
     );
 
-    require HTML::TreeBuilder;
-    my $tree = HTML::TreeBuilder->new;
-    $tree->parse_content( $self->mech->content );
-    $tree->elementify;
-
-    my ($notice) = $tree->look_down( class => 'notice' );
-    if ( $notice && $notice->as_text =~ /has been updated/ ) {
-        return 1;
-    }
+    return $self->html_contains(
+        look_down => [ class => 'notice' ],
+        as_text   => qr/has been updated/,
+    );
 
-    return;
 }
 
 

Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/IssueSearch.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/IssueSearch.pm	(original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/IssueSearch.pm	Mon Feb  9 06:54:51 2009
@@ -69,8 +69,7 @@
 # get a ticket list
         $self->ids([]); # clean previous ids
 
-        require HTML::TreeBuilder;
-        my $tree = HTML::TreeBuilder->new;
+        my $tree = $self->html_tree;
         $tree->parse_content($content);
         my $pagination = $tree->look_down( class => 'pagination' );
         if ( my ( $start, $end, $total ) =
@@ -87,7 +86,7 @@
                 if ($mech->follow_link( text_regex => qr/Next\s+/ ) ) {
                     if ( $mech->response->is_success ) {
                         my $content = $mech->content;
-                        my $tree    = HTML::TreeBuilder->new;
+                        my $tree = $self->html_tree;
                         $tree->parse_content($content);
                         my @ids = $tree->look_down( class => 'vt id col_0' );
                         @ids =

Modified: Net-Google-Code/branches/write/lib/Net/Google/Code/WikiEntry.pm
==============================================================================
--- Net-Google-Code/branches/write/lib/Net/Google/Code/WikiEntry.pm	(original)
+++ Net-Google-Code/branches/write/lib/Net/Google/Code/WikiEntry.pm	Mon Feb  9 06:54:51 2009
@@ -39,8 +39,7 @@
         
         my $html = $self->__html;
         
-        require HTML::TreeBuilder;
-        my $tree = HTML::TreeBuilder->new;
+        my $tree = $self->html_tree;
         $tree->parse_content($html);
         $tree->elementify;
         



More information about the Bps-public-commit mailing list