Mojo::IOLoop::Subprocess::Role::Sereal - Subprocesses with Sereal
use Mojo::IOLoop; # Operation that would block the event loop for 5 seconds my $subprocess = Mojo::IOLoop->subprocess->with_roles('+Sereal')->with_sereal->run( 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::Role::Sereal provides a "with_sereal" method for Mojo::IOLoop::Subprocess objects that will update its serialize and deserialize attributes to use 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.
serialize
deserialize
Regexp
See Mojo::IOLoop::Subprocess::Sereal for a method to retrieve a subprocess object using Sereal directly from Mojo::IOLoop.
Mojo::IOLoop::Subprocess::Role::Sereal composes the following methods.
$subprocess = $subprocess->with_sereal;
Set "deserialize" in Mojo::IOLoop::Subprocess and "serialize" in Mojo::IOLoop::Subprocess to callbacks that use Sereal for data serialization.
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::Subprocess, Mojo::IOLoop::Subprocess::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.