class.pl - Example 'threadsafe' class code
This example class illustrates how to create hash-based objects that can be shared between threads using threads::shared. In addition, it shows how to permit the objects' fields to contain arbitrarily complex data structures.
The class contructor takes parameters in the form of key=>value pairs, and adds them as fields to the newly created shared object. The values may be any complex data structures, and are themselves made shared.
key=>value
This method adds/sets a field for a shared object, making the value for the field shared if necessary.
threads, threads::shared
Jerry D. Hedden, <jdhedden AT cpan DOT org>
Copyright 2006 - 2009 Jerry D. Hedden. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install threads::shared, copy and paste the appropriate command in to your terminal.
cpanm
cpanm threads::shared
CPAN shell
perl -MCPAN -e shell install threads::shared
For more information on module installation, please visit the detailed CPAN module installation guide.