in reply to XML::Simple broken in 5.8.0?

Yes, you do need to upgrade to version 2.02 of XML::Simple.

When I was initially developing XML::Simple, I read an article in the Perl Journal extolling the virtues of the 'new' threading capabilities introduced in Perl 5.005(?). The article showed how to make your module thread safe in a backwards compatible way (ie: the code would still run on versions of Perl without thread support), so I added the relevant code - even though I never used threading myself.

As it turned out, that original threading model has been replaced by the 'iThreads' model in Perl 5.8. The new model is much safer since nothing is shared between threads unless you explicitly request it (in the old model everything was shared by default). Since there probably weren't too many people using the 5.005 threads and my locking code didn't work with the new model, I removed the old style locking code in version 2.00.

Version 2.01 fixed a bug in the new 'strict mode'. Version 2.02 fixed a potential concurrency issue with the caching via Storable - file locking is now used when reading/writing the cache file (thanks merlyn for pointing that out).

Update: The iThreads model was actually introduced in Perl 5.6.0 and is now considered stable in 5.8.0.

Replies are listed 'Best First'.
Re: Re: XML::Simple broken in 5.8.0?
by grantm (Parson) on Dec 16, 2002 at 21:27 UTC

    And just to clear up potentially confusing use of the term 'lock' ...

    In a multi-threaded environment, if two threads have access to the same variable, then locking must be used to ensure that each thread can safely read/write the variable without corrupting it.

    In a multi-process (or for that matter multi-threaded) environment if two processes (or threads) have access to the same file, then then locking must be used to ensure that each thread can safely read/write the file without corrupting it.

    The Fcntl module (in combination with the built-in 'flock' function) is used for file locking. The 'lock' function is provided by Perl's threading implementation and is used for locking variables.

Re: Re: XML::Simple broken in 5.8.0?
by theguvnor (Chaplain) on Dec 16, 2002 at 21:12 UTC

    Thanks for the response grantm. I had actually just finished copying 2.02 into place and verifying that it solved the problem, after some private messages with PodMaster in the chatterbox.

    Hopefully ActiveState will include the updated version of XML::Simple into their next build of Perl 5.8.x.

    Thanks again, all.

    Jon