use Path::Tiny qw(path); use Sereal::Encoder qw(encode_sereal SRL_SNAPPY); use Sereal::Decoder qw(decode_sereal); use Test::More; use Test::Deep qw(cmp_deeply); my @categories = 1..100; my $categoriesFile = glob "~/categories.sereal"; { my $path = path($categoriesFile); $path->filehandle({exclusive => 1}, '>'); $path->spew_raw(encode_sereal \@categories, { compress => SRL_SNAPPY, croak_on_bless => 1 }); } { my $path = path($categoriesFile); $path->filehandle({exclusive => 1}, '<'); my @categories2 = decode_sereal($path->slurp_raw, { refuse_objects => 1, validate_utf8 => 1 })->@*; cmp_deeply \@categories, \@categories2; } done_testing;