[Bps-public-commit] Net-Google-Code branch, master, updated. 39ede93886ca059e4d3e486faca01454a1f22c2f

? sunnavy sunnavy at bestpractical.com
Wed Apr 7 08:50:02 EDT 2010


The branch, master has been updated
       via  39ede93886ca059e4d3e486faca01454a1f22c2f (commit)
       via  fc93774b6e6efcf16cb34a4ad367ccd005c0f2b5 (commit)
       via  33b7f9ae1d60779ccf1f17f9c5dea3b460733647 (commit)
      from  d411b1abf0fd5a8ef9b51fbed386f07024020e5f (commit)

Summary of changes:
 Changes                                 |    6 +++++-
 lib/Net/Google/Code.pm                  |    5 ++++-
 lib/Net/Google/Code/Download.pm         |    2 ++
 lib/Net/Google/Code/Issue.pm            |    9 ++++++---
 lib/Net/Google/Code/Issue/Attachment.pm |   18 +++++++-----------
 lib/Net/Google/Code/Issue/Comment.pm    |    5 ++++-
 lib/Net/Google/Code/Issue/Util.pm       |    1 +
 lib/Net/Google/Code/Role/HTMLTree.pm    |   10 +++++++---
 lib/Net/Google/Code/Role/Pageable.pm    |    4 ++++
 lib/Net/Google/Code/Wiki.pm             |    2 ++
 lib/Net/Google/Code/Wiki/Comment.pm     |    3 ++-
 11 files changed, 44 insertions(+), 21 deletions(-)

- Log -----------------------------------------------------------------
commit 33b7f9ae1d60779ccf1f17f9c5dea3b460733647
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 7 20:37:46 2010 +0800

    explictly delete html_tree since it is circular referenced

diff --git a/lib/Net/Google/Code.pm b/lib/Net/Google/Code.pm
index e055963..50ef7e7 100644
--- a/lib/Net/Google/Code.pm
+++ b/lib/Net/Google/Code.pm
@@ -94,6 +94,7 @@ sub load {
 sub parse {
     my $self    = shift;
     my $tree    = shift;
+    my $need_delete = not blessed $tree;
     $tree = $self->html_tree( html => $tree ) unless blessed $tree;
 
     my $summary =
@@ -125,6 +126,7 @@ sub parse {
         push @labels, $tag->content_array_ref->[0];
     }
     $self->labels( \@labels ) if @labels;
+    $tree->delete if $need_delete;
     return 1;
 }
 
@@ -169,6 +171,7 @@ sub load_wikis {
             push @wikis, $wiki;
         }
     }
+    $tree->delete;
     $self->wikis( \@wikis );
 }
 
diff --git a/lib/Net/Google/Code/Download.pm b/lib/Net/Google/Code/Download.pm
index 305e69c..1128ff9 100644
--- a/lib/Net/Google/Code/Download.pm
+++ b/lib/Net/Google/Code/Download.pm
@@ -69,6 +69,7 @@ sub load {
 sub parse {
     my $self = shift;
     my $tree = shift;
+    my $need_delete = not blessed $tree;
     $tree = $self->html_tree( html => $tree ) unless blessed $tree;
 
     my $entry;
@@ -120,6 +121,7 @@ sub parse {
     if ( $checksum =~ /^SHA1 Checksum:\s+(\w+)/ ) {
         $self->checksum( $1 );
     }
+    $tree->delete if $need_delete;
 }
 
 sub BUILDARGS {
diff --git a/lib/Net/Google/Code/Issue.pm b/lib/Net/Google/Code/Issue.pm
index 0b938a9..50b9dc9 100644
--- a/lib/Net/Google/Code/Issue.pm
+++ b/lib/Net/Google/Code/Issue.pm
@@ -124,6 +124,7 @@ sub parse {
     my $self    = shift;
     my $tree    = shift;
 
+    my $need_delete = not blessed $tree;
     $tree = $self->html_tree( html => $tree ) unless blessed $tree;
 
     # extract summary
@@ -257,7 +258,8 @@ sub parse {
     unshift @comments, $initial_comment;
 
     $self->comments( \@comments );
-
+    $tree->delete if $need_delete;
+    return 1;
 }
 
 sub load_comments {
@@ -276,7 +278,7 @@ sub load_comments {
 sub parse_hybrid {
     my $self    = shift;
     my $tree    = shift;
-
+    my $need_delete = not blessed $tree;
     $tree = $self->html_tree( html => $tree ) unless blessed $tree;
 
     my $description = $tree->look_down( class => 'vt issuedescription' );
@@ -371,7 +373,8 @@ sub parse_hybrid {
         $initial_comment->updates->{$_} = $self->$_;
     }
     $self->comments->[0] = $initial_comment;
-
+    $tree->delete if $need_delete;
+    return 1;
 }
 
 sub _load_from_xml {
diff --git a/lib/Net/Google/Code/Issue/Attachment.pm b/lib/Net/Google/Code/Issue/Attachment.pm
index ce71f5b..0875ae0 100644
--- a/lib/Net/Google/Code/Issue/Attachment.pm
+++ b/lib/Net/Google/Code/Issue/Attachment.pm
@@ -25,17 +25,10 @@ has content_type => (
 
 sub parse {
     my $self = shift;
-    my $html = shift;
-
-    my $tr;
-
-    if ( blessed $html ) {
-        $tr = $html->find_by_tag_name( 'tr' );
-    }
-    else {
-        my $tree = $self->html_tree( html => $html );
-        $tr = $tree->find_by_tag_name( 'tr' );
-    }
+    my $tree    = shift;
+    my $need_delete = not blessed $tree;
+    $tree = $self->html_tree( html => $tree ) unless blessed $tree;
+    my $tr = $tree->find_by_tag_name('tr');
 
     my $b    = $tr->find_by_tag_name('b');    # name lives here
     if ($b) {
@@ -71,12 +64,14 @@ sub parse {
         }
     }
 
+    $tree->delete if $need_delete;
     return 1;
 }
 
 sub parse_attachments {
     my $self    = shift;
     my $element = shift;
+    my $need_delete = not blessed $element;
     $element = $self->html_tree( html => $element ) unless blessed $element;
 
     my @attachments;
@@ -90,6 +85,7 @@ sub parse_attachments {
             push @attachments, $a;
         }
     }
+    $element->delete if $need_delete;
     return @attachments;
 }
 
diff --git a/lib/Net/Google/Code/Issue/Comment.pm b/lib/Net/Google/Code/Issue/Comment.pm
index b87a3ff..9d6a296 100644
--- a/lib/Net/Google/Code/Issue/Comment.pm
+++ b/lib/Net/Google/Code/Issue/Comment.pm
@@ -30,6 +30,7 @@ has 'issue_id' => (
 sub parse {
     my $self    = shift;
     my $element = shift;
+    my $need_delete = not blessed $element;
     $element = $self->html_tree( html => $element ) unless blessed $element;
 
     my $author  = $element->look_down( class => 'author' );
@@ -87,12 +88,14 @@ sub parse {
       if $att_tag;
     $self->attachments( \@attachments );
 
+    $self->delete if $need_delete;
     return 1;
 }
 
 sub parse_hybrid {
     my $self    = shift;
     my $element = shift;
+    my $need_delete = not blessed $element;
     $element = $self->html_tree( html => $element ) unless blessed $element;
     my $updates = $element->look_down( class => 'updates' );
     if ($updates) {
@@ -127,7 +130,7 @@ sub parse_hybrid {
       Net::Google::Code::Issue::Attachment->parse_attachments($att_tag)
       if $att_tag;
     $self->attachments( \@attachments );
-
+    $element->delete if $need_delete;
     return 1;
 }
 
diff --git a/lib/Net/Google/Code/Issue/Util.pm b/lib/Net/Google/Code/Issue/Util.pm
index 1115d05..36894c1 100644
--- a/lib/Net/Google/Code/Issue/Util.pm
+++ b/lib/Net/Google/Code/Issue/Util.pm
@@ -59,6 +59,7 @@ sub translate_from_xml {
                       . ( $ref->{$k}->{'#text'} || '' )
                       . '</pre>' );
                 $text = $tree->as_text if $tree;
+                $tree->delete;
             }
             else {
                 $text = $ref->{$k}->{'#text'};
diff --git a/lib/Net/Google/Code/Role/HTMLTree.pm b/lib/Net/Google/Code/Role/HTMLTree.pm
index b06b52a..bca8d4b 100644
--- a/lib/Net/Google/Code/Role/HTMLTree.pm
+++ b/lib/Net/Google/Code/Role/HTMLTree.pm
@@ -28,12 +28,13 @@ sub html_tree_contains {
     );
 
     my $tree;
-
+    my $need_delete;
     if ( blessed $args{html} ) {
         $tree = $args{html};
     }
     else {
         $tree = $self->html_tree( html => $args{html} );
+        $need_delete = 1;
     }
 
     my $part = $tree;
@@ -41,9 +42,12 @@ sub html_tree_contains {
         ($part) = $tree->look_down( @{ $args{look_down} } );
     }
 
-    return unless $part;
 
-    my $text = $part->as_text;
+    my $text = $part && $part->as_text;
+    $tree->delete if $need_delete;
+
+    return unless defined $text;
+
     return 1 if $text eq $args{as_text};
 
     if ( ( ref $args{as_text} eq 'Regexp' ) && ( my @captures =
diff --git a/lib/Net/Google/Code/Role/Pageable.pm b/lib/Net/Google/Code/Role/Pageable.pm
index 6a4ec1a..28850ad 100644
--- a/lib/Net/Google/Code/Role/Pageable.pm
+++ b/lib/Net/Google/Code/Role/Pageable.pm
@@ -21,6 +21,7 @@ sub rows {
 
     $args{limit} ||= 999_999_999; # the impossible huge limit
     my $tree = $args{html};
+    my $need_delete = not blessed $tree;
     $tree = $self->html_tree( html => $tree ) unless blessed $tree;
 
     # assuming there's at most 20 columns
@@ -84,6 +85,7 @@ sub rows {
         }
     }
 
+    $tree->delete if $need_delete;
     if ( scalar @rows > $args{limit} ) {
         # this happens when limit is less than the 1st page's number, so in
         # some similar situations 
@@ -105,6 +107,7 @@ sub _rows {
         }
     );
     my $tree = $args{html};
+    my $need_delete = not blessed $tree;
     $tree = $self->html_tree( html => $tree ) unless blessed $tree;
     my @titles = @{$args{titles}};
     my $label_column = $args{label_column};
@@ -144,6 +147,7 @@ sub _rows {
             $k++;
         }
     }
+    $tree->delete if $need_delete;
     return @rows;
 }
 
diff --git a/lib/Net/Google/Code/Wiki.pm b/lib/Net/Google/Code/Wiki.pm
index 466d1cd..04bafac 100644
--- a/lib/Net/Google/Code/Wiki.pm
+++ b/lib/Net/Google/Code/Wiki.pm
@@ -112,6 +112,8 @@ sub parse {
         push @comments, $comment;
     }
     $self->comments( \@comments );
+    $tree->delete;
+    return 1;
 }
 
 no Any::Moose;
diff --git a/lib/Net/Google/Code/Wiki/Comment.pm b/lib/Net/Google/Code/Wiki/Comment.pm
index 7be0bc6..2dca6c4 100644
--- a/lib/Net/Google/Code/Wiki/Comment.pm
+++ b/lib/Net/Google/Code/Wiki/Comment.pm
@@ -22,7 +22,7 @@ has 'date' => (
 sub parse {
     my $self    = shift;
     my $element = shift;
-
+    my $need_update = not blessed $element;
     $element = $self->html_tree( html => $element ) unless blessed $element;
 
     my $author =
@@ -34,6 +34,7 @@ sub parse {
     $self->author( $author ) if $author;
     $self->date( $date ) if $date;
     $self->content( $content ) if $content;
+    $element->delete if $need_update;
     return 1;
 }
 

commit fc93774b6e6efcf16cb34a4ad367ccd005c0f2b5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 7 20:40:23 2010 +0800

    release version 0.18

diff --git a/Changes b/Changes
index 0a72aa8..175bd3c 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Net-Google-Code
 
-0.18
+0.18 Wed Apr  7 12:38:05 GMT 2010
+
+* explicitly delete HTML::TreeBuilder object
 
 0.17 Fri Jan 29 04:15:09 UTC 2010
 

commit 39ede93886ca059e4d3e486faca01454a1f22c2f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 7 20:43:47 2010 +0800

    bump version to 0.19

diff --git a/Changes b/Changes
index 175bd3c..89ee070 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 Revision history for Net-Google-Code
 
+0.19
+
 0.18 Wed Apr  7 12:38:05 GMT 2010
 
 * explicitly delete HTML::TreeBuilder object
diff --git a/lib/Net/Google/Code.pm b/lib/Net/Google/Code.pm
index 50ef7e7..7bc3f72 100644
--- a/lib/Net/Google/Code.pm
+++ b/lib/Net/Google/Code.pm
@@ -4,7 +4,7 @@ use Any::Moose;
 with 'Net::Google::Code::TypicalRoles';
 use Scalar::Util qw/blessed/;
 
-our $VERSION = '0.18';
+our $VERSION = '0.19';
 
 has 'project' => (
     isa      => 'Str',

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list