r45866 - in /branches/upstream/libparse-mediawikidump-perl/current: Changes META.yml Makefile.PL lib/Parse/MediaWikiDump.pm lib/Parse/MediaWikiDump/Revisions.pm lib/Parse/MediaWikiDump/XML.pm t/revisions.t t/revisions_test.xml

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Fri Oct 16 02:09:09 UTC 2009


Author: jawnsy-guest
Date: Fri Oct 16 02:09:02 2009
New Revision: 45866

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=45866
Log:
[svn-upgrade] Integrating new upstream version, libparse-mediawikidump-perl (0.95)

Modified:
    branches/upstream/libparse-mediawikidump-perl/current/Changes
    branches/upstream/libparse-mediawikidump-perl/current/META.yml
    branches/upstream/libparse-mediawikidump-perl/current/Makefile.PL
    branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump.pm
    branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/Revisions.pm
    branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/XML.pm
    branches/upstream/libparse-mediawikidump-perl/current/t/revisions.t
    branches/upstream/libparse-mediawikidump-perl/current/t/revisions_test.xml

Modified: branches/upstream/libparse-mediawikidump-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/Changes?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/Changes (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/Changes Fri Oct 16 02:09:02 2009
@@ -1,4 +1,9 @@
 Revision history for Parse-MediaWikiDump
+
+0.95	
+	* Found and removed a circular reference but it did not
+	  stop the memory leak
+	* Fixed bug 50092
 
 0.94	Sep 28, 2009
 	* Fix bug 49979 - "redirect in newer Wikipedia dumps" by allowing

Modified: branches/upstream/libparse-mediawikidump-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/META.yml?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/META.yml (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/META.yml Fri Oct 16 02:09:02 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Parse-MediaWikiDump
-version:            0.94
+version:            0.95
 abstract:           Tools to process MediaWiki dump files
 author:
     - Tyler Riddle <triddle at gmail.com>
@@ -11,6 +11,7 @@
 requires:
     List::Util:         0
     Object::Destroyer:  0
+    Scalar::Util:       0
     Test::Exception:    0
     Test::More:         0
     XML::Parser:        0

Modified: branches/upstream/libparse-mediawikidump-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/Makefile.PL?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/Makefile.PL (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/Makefile.PL Fri Oct 16 02:09:02 2009
@@ -15,6 +15,7 @@
     'List::Util' => 0,
     'Object::Destroyer' => 0,
     'Test::Exception' => 0,
+    'Scalar::Util' => 0,
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'Parse-MediaWikiDump-*' },

Modified: branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump.pm?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump.pm (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump.pm Fri Oct 16 02:09:02 2009
@@ -1,5 +1,5 @@
 package Parse::MediaWikiDump;
-our $VERSION = '0.94';
+our $VERSION = '0.95';
 
 use Parse::MediaWikiDump::XML;
 use Parse::MediaWikiDump::Revisions;

Modified: branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/Revisions.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/Revisions.pm?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/Revisions.pm (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/Revisions.pm Fri Oct 16 02:09:02 2009
@@ -1,12 +1,13 @@
 package Parse::MediaWikiDump::Revisions;
 
-our $VERSION = '0.94';
+our $VERSION = '0.95';
 
 use 5.8.0;
 
 use strict;
 use warnings;
 use List::Util;
+use Scalar::Util qw(weaken reftype);
 use Object::Destroyer;
 use Data::Dumper;
 
@@ -109,7 +110,7 @@
 sub cleanup {
 	my ($self) = @_;
 	
-	warn "executing cleanup";
+	#warn "executing cleanup";
 	
 	$self->{EXPAT}->setHandlers(Init => undef, Final => undef, Start => undef, 
 		End => undef, Char => undef);
@@ -120,7 +121,7 @@
 sub open {
 	my ($self, $source) = @_;
 
-	if (ref($source) eq 'GLOB') {
+	if (defined(reftype($source)) && reftype($source) eq 'GLOB') {
 		$$self{SOURCE} = $source;
 	} else {
 		if (! open($$self{SOURCE}, $source)) {
@@ -152,6 +153,9 @@
 		
 		$self->parse_more;	
 	}
+	
+	#XML::Accumulator holds a copy of itself
+	weaken($self->{XML});
 }
 
 sub new_accumulator_engine {
@@ -215,7 +219,9 @@
                 die "error during read: $!";
         } elsif ($read == 0) {
                 $$self{FINISHED} = 1;
-                $$self{EXPAT} = undef; #Object::Destroyer cleans this up
+                #$$self{EXPAT} = undef; #Object::Destroyer cleans this up
+                $$self{EXPAT}->parse_done;
+                
                 return 0;
         }
 

Modified: branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/XML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/XML.pm?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/XML.pm (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/lib/Parse/MediaWikiDump/XML.pm Fri Oct 16 02:09:02 2009
@@ -2,7 +2,7 @@
 #testing is done and documentation is written
 package Parse::MediaWikiDump::XML::Accumulator;
 
-our $VERSION = '0.94';
+our $VERSION = '0.95';
 
 use warnings;
 use strict;
@@ -41,6 +41,7 @@
 use warnings;
 use Carp qw(croak);
 
+use Scalar::Util qw(weaken);
 use XML::Parser;
 use Object::Destroyer;
 
@@ -63,8 +64,8 @@
 	$self->{char_dirty} = 0;
 	$self->{node_stack} = [ $root ];
 	
-	return Object::Destroyer->new($self, 'cleanup');
-	#return $self;
+	#return Object::Destroyer->new($self, 'cleanup');
+	return $self;
 }
 
 sub cleanup {
@@ -85,7 +86,7 @@
 			#Final => sub { handle_final_event($self, @_) },
 			Start => sub { handle_start_event($self, @_) },
 			End => sub { handle_end_event($self, @_) },
-			Char => sub { handle_char_event($self, @_) },
+			Char => sub { handle_char_event($self, @_); },
 		}
 	);
 	
@@ -153,14 +154,11 @@
 	my ($self, $expat, $chars) = @_; 
 	
 	$self->{char_buf} .= $chars; 
-	$self->{char_dirty} = 1;
 }
 
 sub flush_chars {
 	my ($self) = @_;
 	my ($handler, $cur_element);
-	
-	return undef unless $self->{char_dirty} == 1;
 	
 	$handler = $self->node->{handlers}->{Character};
 	$cur_element = $self->element;
@@ -172,7 +170,6 @@
 	defined $handler && &$handler($self, $self->{accum}, $self->{char_buf}, @$cur_element);
 		
 	$self->{char_buf} = '';
-	$self->{char_dirty} = 0;
 	
 	return undef;
 }

Modified: branches/upstream/libparse-mediawikidump-perl/current/t/revisions.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/t/revisions.t?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/t/revisions.t (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/t/revisions.t Fri Oct 16 02:09:02 2009
@@ -1,6 +1,6 @@
 #!perl -w
 
-use Test::Simple tests => 94;
+use Test::Simple tests => 98;
 use strict;
 use Parse::MediaWikiDump;
 use Data::Dumper;
@@ -27,6 +27,7 @@
 	test_two();
 	test_three();
 	test_four();
+	test_five();
 	
 	ok(! defined($revisions->next));
 }
@@ -42,7 +43,7 @@
 	ok($revisions->current_byte != 0);
 	
 	if ($mode eq 'file') {
-		ok($revisions->size == 2783);
+		ok($revisions->size == 3112);
 	} elsif ($mode eq 'handle') {
 		ok(! defined($revisions->size));
 	} else {
@@ -117,3 +118,11 @@
 	ok($page->namespace eq '');
 	ok($page->title eq 'NotANameSpace:Bar');
 }
+
+#test for Bug 50092
+sub test_five {
+	my $page = $revisions->next;
+	ok($page->title eq 'Bug 50092 Test');
+	ok(defined(${$page->text}));		
+}
+

Modified: branches/upstream/libparse-mediawikidump-perl/current/t/revisions_test.xml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-mediawikidump-perl/current/t/revisions_test.xml?rev=45866&op=diff
==============================================================================
--- branches/upstream/libparse-mediawikidump-perl/current/t/revisions_test.xml (original)
+++ branches/upstream/libparse-mediawikidump-perl/current/t/revisions_test.xml Fri Oct 16 02:09:02 2009
@@ -76,4 +76,16 @@
     </revision>
 </page>
 
+<page>
+  <title>Bug 50092 Test</title>
+  <id>5</id>
+    <revision>
+      <id>47089</id>
+      <timestamp>2005-07-09T18:41:10Z</timestamp>
+      <contributor><username>Username Test Value</username><id>1292</id></contributor>
+      <comment>Comment Test Value</comment>
+      <text xml:space="preserve"/>
+    </revision>
+</page>
+
 </mediawiki>




More information about the Pkg-perl-cvs-commits mailing list