NAME

   Mojo::IOLoop::Subprocess::Sereal - Subprocesses with Sereal

SYNOPSIS

     use Mojo::IOLoop::Subprocess::Sereal;

     # Operation that would block the event loop for 5 seconds
     my $subprocess = Mojo::IOLoop::Subprocess::Sereal->new;
     $subprocess->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
     $subprocess->ioloop->start unless $subprocess->ioloop->is_running;

DESCRIPTION

   Mojo::IOLoop::Subprocess::Sereal is a subclass of
   Mojo::IOLoop::Subprocess which uses 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.

   Note that Mojo::IOLoop::Subprocess is EXPERIMENTAL and thus so is this
   module!

ATTRIBUTES

   Mojo::IOLoop::Subprocess::Sereal inherits all attributes from
   Mojo::IOLoop::Subprocess and implements the following new ones.

deserialize

     my $cb      = $subprocess->deserialize;
     $subprocess = $subprocess->deserialize(sub {...});

   A callback used to deserialize subprocess return values, defaults to
   using Sereal::Decoder.

     $subprocess->deserialize(sub {
       my $bytes = shift;
       return [];
     });

serialize

     my $cb      = $subprocess->serialize;
     $subprocess = $subprocess->serialize(sub {...});

   A callback used to serialize subprocess return values, defaults to
   using Sereal::Encoder.

     $subprocess->serialize(sub {
       my $array = shift;
       return '';
     });

METHODS

   Mojo::IOLoop::Subprocess::Sereal inherits all methods from
   Mojo::IOLoop::Subprocess.

BUGS

   Report any issues on the public bugtracker.

AUTHOR

   Dan Book <[email protected]>

COPYRIGHT AND LICENSE

   This software is Copyright (c) 2016 by Dan Book.

   This is free software, licensed under:

     The Artistic License 2.0 (GPL Compatible)

SEE ALSO

   Mojo::IOLoop, Sereal