backport DXSubprocess to change serialisations
[spider.git] / perl / DXSubprocess.pm
diff --git a/perl/DXSubprocess.pm b/perl/DXSubprocess.pm
new file mode 100644 (file)
index 0000000..4442762
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# A light shim over Mojo::IOLoop::Subprocess (or Mojo::IOLoop::ForkCall, if we need to go back to that)
+#
+# But we stop using Storable!
+#
+
+package DXSubprocess;
+
+use DXUtil;
+use DXDebug;
+use Mojo::IOLoop;
+use    Mojo::IOLoop::Subprocess;
+use JSON;
+
+our @ISA = qw(Mojo::IOLoop::Subprocess);
+
+sub new
+{
+       my $pkg = shift;
+       my $class = ref $pkg || __PACKAGE__;
+       my $ref = Mojo::IOLoop::Subprocess->new->serialize(\&encode_json)->deserialize(\&decode_json);
+       return bless $ref, $class;
+}