zentara has asked for the wisdom of the Perl Monks concerning the following question:

UPDATE: Never mind, I upgraded to the latest XML::Simple-2.14, and it solved the problem. Sorry everyone, that's 2 module updates I screwed up on this week. :-)

Hi, I have a sub that uses XML::Simple to parse an xml file. I tried to put it into a thread, and it would fail with

thread failed to start: lock can only be used on shared values at /usr +/lib/perl5/site_perl/5.8.6/XML/Simple.pm line 479.
So I checked out line 479 and it's just
lock($DefaultValues); #where $DefaultValues = 1
So I copied XML/Simple.pm to my local directory and ran it with line 479 commented out, and everything works fine.

So I have a couple of questions:

1. Will I terribly break something without "lock(1)"?

2. Is it possible to make a custom inherited widget of XML/Simple that I can turn locking off, without having to use a customized version?


I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re: XML::Simple in threads
by grantm (Parson) on Sep 10, 2005 at 21:02 UTC

    No, you won't break anything. That line is not present in any version of XML::Simple released since October 2002.

    The purpose of the line was for compatibility with the original Perl threading model in 5.005 which was subsequently superceded with the new iThreads model.