threads::emulate - Create and use emulated threads (and share vars easyer)
Version 0.0.4
This module was made because I don't like to have to "declare" every "sub-level" of a shared var using threads::shared. This is NOT real threads. We use UNIX sockets to emulate shared variables.
threads::shared
use threads::emulate; my $shared_var : Shared; $shared_var = [1..5]; # Congratulations! Now you have a shared array_ref! $shared_var->[5] = {jan => 1, feb => 2}; # Now inside of the array_ref there's a hash_ref! $shared_var->[5]->{obj} = Any::Class->new; # End now there's a object! lock \$shared_var; # Yes... You have to use ref... async{ lock \$shared_var; $shared_var->[0] .= "K"; }; $shared_var->[0] = "O"; unlock \$shared_var; sleep 1; print $shared_var->[0], $/; # prints "OK" (I hope... :) )
This module exports 3 functions: async, lock and unlock.
#=head2 _create # #Internal use. #
This func is exported by default. It receives only one parameter, a sub_ref. It returns a thread::emulate::async object.
This func is exported by default. It receives only one parameter, a reference for a shared var.
Fernando Correa de Oliveira, <fco at cpan.org>
<fco at cpan.org>
Please report any bugs or feature requests to bug-threads-emulate at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=threads-emulate. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-threads-emulate at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc threads::emulate
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=threads-emulate
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/threads-emulate
CPAN Ratings
http://cpanratings.perl.org/d/threads-emulate
Search CPAN
http://search.cpan.org/dist/threads-emulate/
Copyright 2009 Fernando Correa de Oliveira, 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::emulate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm threads::emulate
CPAN shell
perl -MCPAN -e shell install threads::emulate
For more information on module installation, please visit the detailed CPAN module installation guide.