allow glob references to be transferred
[scpubgit/Object-Remote.git] / t / lib / ORTestGlobs.pm
diff --git a/t/lib/ORTestGlobs.pm b/t/lib/ORTestGlobs.pm
new file mode 100644 (file)
index 0000000..a67eb0e
--- /dev/null
@@ -0,0 +1,26 @@
+package ORTestGlobs;
+use Moo;
+
+has handle => (is => 'rw');
+has valueref => (is => 'ro', default => sub {
+  my $body = '';
+  return \$body;
+});
+
+sub write { my $self = shift; print { $self->handle } @_ }
+
+sub getvalue { ${ $_[0]->valueref } }
+
+sub gethandle {
+  open my $fh, '>', $_[0]->valueref
+    or die "Unable to open in-memory file: $!\n";
+  return $fh;
+}
+
+sub getreadhandle {
+  open my $fh, '<', $_[1]
+    or die "Unable to open in-memory file: $!\n";
+  return $fh;
+}
+
+1;