http://www.perlmonks.org?node_id=1006132


in reply to Re^2: XML::Twig and threads
in thread XML::Twig and threads [solved]

I understand your situation at last.
So, copying original and reuse it will be like this.

my $t= XML::Twig->new(); $t->parsefile($inputFile); my $someData =$t->root->first_child; #someData for my $i(1 .. $loop) { for ( $someData->children_copy( 'managedObject') ){ handle_managedObject($t, $_); } print "Iteracja: $i / $loop \t-> OK\n"; $bID++; $someID = 0; }
It becomes slower than original with my machine. Because deep coping Elt object takes too much time for large XML. I wonder is this same at your environment? Or maybe you already know this ...

As BrowserUK says, use strict and warning please.