Re: XML::Twig - Memory usage problem

mirod <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
howard chen wrote:
> #!/usr/bin/perl
> 
> use XML::Twig;
> 
> my $cnt = 0;
> 
> my $t = XML::Twig->new(
> 		twig_roots => {
> 			company => sub {
> 
> 				if ($cnt % 10000 == 0 ) {
> 					print "Processing element: $cnt\n";
> 					die if ($cnt == 100000);
> 				}
> 
> 				$cnt++;
> 				@_[0]->purge;
> 			},
> 		}
> 	);
> 
> $t->parsefile( "company.xml" );
> $t->purge;

Is this a direct cut'n paste?

Because it should be $_[0]->purge in the sub, not @_[0]. (always, ALWAYS use
strict...)

-- mirod
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.