Pots::SharedObject - Perl ObjectThreads base class for thread shared objects
package My::Shared::Class;
use base qw(Pots::SharedObject);
sub new { my $class = shift;
my $self = $class->SUPER::new(); return $self; }
Pots::SharedObject is a base class for all Pots objects that need to be shared between threads.
Pots::SharedObject
Standard method for creating a hash-based shared object. If you define your own "new()" method, don't forget to call "$class->SUPER::new()" before.
This method is called when the shared object is being destroyed, that is no other objects references it. It uses the standard Perl "DESTROY", so you should not use it in your derived classes. Redefine "destroy()" and put your cleanup code in it.
The DESTROY "trick" for shared objects was stolen from Mike Pomraning. I found it in the "perl.ithreads" list: http://www.nntp.perl.org/group/perl.ithreads/766
Remy Chibois <rchibois at free.fr>
Copyright (c) 2004 Remy Chibois. 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 Pots::Thread, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pots::Thread
CPAN shell
perl -MCPAN -e shell install Pots::Thread
For more information on module installation, please visit the detailed CPAN module installation guide.