commit: 23da30a201494a536b54bdf354073d4fa7c1dac4
parent 45ec205ca40056411a2939456fefa67953db9e63
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 13 Oct 2022 03:57:37 +0200
Add support for Perl Storable data
See the WARNING section of `perldoc Storable` if you're wondering why it got included.
Diffstat:
7 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/.reuse/dep5 b/.reuse/dep5
@@ -3,6 +3,6 @@ Upstream-Name: deblob
Upstream-Contact: deblob Authors <https://hacktivis.me/projects/deblob>
Source: https://hacktivis.me/projects/deblob
-Files: test/fixtures/pyc/*.pyc test/fixtures/hello.luac* test/fixtures/hello.class test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc
+Files: test/fixtures/pyc/*.pyc test/fixtures/hello.luac* test/fixtures/hello.class test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc test/fixtures/perl_storage.pst
Copyright: 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
License: BSD-3-Clause
diff --git a/Makefile b/Makefile
@@ -16,9 +16,10 @@ REUSE ?= reuse
JAVAC ?= javac
NQP ?= nqp
PARROT ?= parrot
+PERL ?= perl
EXE = deblob
-TEST_BLOBS = test/fixtures/hello test/fixtures/hello.a test/fixtures/hello.o test/fixtures/hello.exe test/fixtures/hello.luac53 test/fixtures/hello.luac54 test/fixtures/hello.wasm test/fixtures/hello.class test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc
+TEST_BLOBS = test/fixtures/hello test/fixtures/hello.a test/fixtures/hello.o test/fixtures/hello.exe test/fixtures/hello.luac53 test/fixtures/hello.luac54 test/fixtures/hello.wasm test/fixtures/hello.class test/fixtures/hello.nqp.moarvm test/fixtures/hello.pir.pbc test/fixtures/perl_storage.pst
all: $(EXE)
@@ -59,6 +60,9 @@ test/fixtures/hello.nqp.moarvm: test/fixtures/hello.nqp
test/fixtures/hello.pir.pbc: test/fixtures/hello.pir
$(PARROT) -o $@ test/fixtures/hello.pir
+test/fixtures/perl_storage.pst: test/fixtures/perl_storage.pm
+ $(PERL) test/fixtures/perl_storage.pm
+
.PHONY: test
test: all $(TEST_BLOBS)
rm -fr test/check_dir-fixtures
diff --git a/README.md b/README.md
@@ -28,6 +28,7 @@ Dependencies:
- Java Development Kit, defaults to `javac`. Any version should work, including early bootstrap with jamvm 1.5+
- [NQP](https://github.com/Raku/nqp) aka Not Quite Perl
- [Parrot](http://www.parrot.org/)
+- Perl5
Rebuilding:
```
diff --git a/deblob.1 b/deblob.1
@@ -64,6 +64,8 @@ Apple Preferred Executable Format
MoarVM bytecode
.It
Parrot bytecode
+.It
+Perl Storable data (v0.6 and v0.7)
.El
.Sh EXAMPLES
The following code block shows how it can be used in Gentoo's
diff --git a/main.ha b/main.ha
@@ -35,6 +35,8 @@ const magic: [_][]u8 = [
['M', 'O', 'A', 'R', 'V', 'M', '\r', '\n'],
// Parrot Bytecode https://github.com/parrot/parrot/blob/master/docs/parrotbyte.pod
[0xFE, 'P', 'B', 'C', '\r', '\n', 0x1A, '\n'],
+ ['p', 'e', 'r', 'l', '-', 's', 't', 'o', 'r', 'e'], // Perl Storable(v0.6)
+ ['p', 's', 't', '0'] // Perl Storable(v0.7)
];
const dos_magic: []u8 = ['M', 'Z'];
const pe_magic: []u8 = ['P', 'E', 0x00, 0x00];
@@ -80,6 +82,7 @@ fn is_blob(filename: str) (bool | fs::error | io::error) = {
("test/fixtures/hello.java", false),
("test/fixtures/hello.nqp", false),
("test/fixtures/hello.pir", false),
+ ("test/fixtures/perl_storage.pm", false),
("test/fixtures/hello", true),
("test/fixtures/hello.luac53", true),
("test/fixtures/hello.luac54", true),
@@ -94,6 +97,7 @@ fn is_blob(filename: str) (bool | fs::error | io::error) = {
("test/fixtures/qemu_vga.ndrv", true),
("test/fixtures/hello.nqp.moarvm", true),
("test/fixtures/hello.pir.pbc", true),
+ ("test/fixtures/perl_storage.pst", true),
("test/fixtures/empty", false),
];
@@ -195,7 +199,7 @@ fn check_dir(dirname: str) (void | errors::invalid) = {
case let e: fs::error =>
fmt::fatalf("os::readdir({}): {}", dirname, fs::strerror(e));
};
- assert(len(files_before) == 31);
+ assert(len(files_before) == 33);
const ret = check_dir(dirname);
assert(ret is void);
@@ -206,7 +210,7 @@ fn check_dir(dirname: str) (void | errors::invalid) = {
case let e: fs::error =>
fmt::fatalf("os::readdir({}): {}", dirname, fs::strerror(e));
};
- assert(len(files_after) == 18);
+ assert(len(files_after) == 19);
};
export fn main() void = {
diff --git a/test/fixtures/perl_storage.pm b/test/fixtures/perl_storage.pm
@@ -0,0 +1,9 @@
+#!/usr/bin/env perl
+# SPDX-FileCopyrightText: 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
+# SPDX-License-Identifier: BSD-3-Clause
+
+use Storable qw(store);
+
+@users = ['Alice', 'Bob', 'Eve'];
+
+store(\@users, 'test/fixtures/perl_storage.pst') or die $!;
diff --git a/test/fixtures/perl_storage.pst b/test/fixtures/perl_storage.pst
Binary files differ.