Jerry D. Hedden > threads-shared > class.pl

Download:
threads-shared-1.32.tar.gz

Annotate this POD

CPAN RT

Open  2
View Bugs
Report a bug
Source  

NAME ^

class.pl - Example 'threadsafe' class code

DESCRIPTION ^

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.

my $obj = My::Class->new('key' => $value, ...)

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.

$obj->set('key' => $value)

This method adds/sets a field for a shared object, making the value for the field shared if necessary.

SEE ALSO ^

threads, threads::shared

AUTHOR ^

Jerry D. Hedden, <jdhedden AT cpan DOT org>

COPYRIGHT AND LICENSE ^

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.