backport DXSubprocess to change serialisations
[spider.git] / perl / DXSubprocess.pm
1 #
2 # A light shim over Mojo::IOLoop::Subprocess (or Mojo::IOLoop::ForkCall, if we need to go back to that)
3 #
4 # But we stop using Storable!
5 #
6
7 package DXSubprocess;
8
9 use DXUtil;
10 use DXDebug;
11 use Mojo::IOLoop;
12 use     Mojo::IOLoop::Subprocess;
13 use JSON;
14
15 our @ISA = qw(Mojo::IOLoop::Subprocess);
16
17 sub new
18 {
19         my $pkg = shift;
20         my $class = ref $pkg || __PACKAGE__;
21         my $ref = Mojo::IOLoop::Subprocess->new->serialize(\&encode_json)->deserialize(\&decode_json);
22         return bless $ref, $class;
23 }