Mojo::IOLoop::Subprocess::Sereal - Subprocesses with Sereal
use Mojo::IOLoop::Subprocess::Sereal; # Operation that would block the event loop for 5 seconds my $subprocess = Mojo::IOLoop->$_subprocess( sub { my $subprocess = shift; sleep 5; return '♥', 'Mojolicious'; }, sub { my ($subprocess, $err, @results) = @_; say "I $results[0] $results[1]!"; } ); # Start event loop if necessary Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
Mojo::IOLoop::Subprocess::Sereal provides a "$_subprocess" method which works as a drop-in replacement for "subprocess" in Mojo::IOLoop while using Sereal for data serialization. Sereal is faster than Storable and supports serialization of more reference types such as Regexp. The "FREEZE/THAW CALLBACK MECHANISM" in Sereal::Encoder is supported to control serialization of blessed objects.
Regexp
See Mojo::IOLoop::Subprocess::Role::Sereal for a role to apply Sereal data serialization to any Mojo::IOLoop::Subprocess.
Mojo::IOLoop::Subprocess::Sereal exports the following variable by default.
my $subprocess = Mojo::IOLoop->$_subprocess(sub {...}, sub {...}); my $subprocess = Mojo::IOLoop->$_subprocess; my $subprocess = $loop->$_subprocess(sub {...}, sub {...});
Build Mojo::IOLoop::Subprocess object to perform computationally expensive operations in subprocesses, without blocking the event loop. Composes and calls "with_sereal" in Mojo::IOLoop::Subprocess::Role::Sereal to use Sereal for data serialization. If arguments are provided, they will be used to call "run" in Mojo::IOLoop::Subprocess.
Report any issues on the public bugtracker.
Dan Book <dbook@cpan.org>
This software is Copyright (c) 2016 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
Mojo::IOLoop, Mojo::IOLoop::Subprocess::Role::Sereal, Sereal
To install Mojo::IOLoop::Subprocess::Sereal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::IOLoop::Subprocess::Sereal
CPAN shell
perl -MCPAN -e shell install Mojo::IOLoop::Subprocess::Sereal
For more information on module installation, please visit the detailed CPAN module installation guide.