From c47b6ff0de038fd6ae15eaee60f2b5cf707c643b Mon Sep 17 00:00:00 2001 From: Christian 'Mithaldu' Walde Date: Sun, 4 May 2025 18:19:48 +0200 Subject: [PATCH] allow plain scalars under JSON --- lib/Data/FlexSerializer.pm | 2 +- t/10basic.t | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Data/FlexSerializer.pm b/lib/Data/FlexSerializer.pm index 9c596ee..e901e9b 100644 --- a/lib/Data/FlexSerializer.pm +++ b/lib/Data/FlexSerializer.pm @@ -17,7 +17,7 @@ use Constant::FromGlobal DEBUG => { int => 1, default => 0, env => 1 }; use List::Util qw(min); use Storable qw(); -use JSON::XS qw(); +use JSON::XS 4 qw(); use Sereal::Decoder qw(); use Sereal::Encoder qw(); use Compress::Zlib qw(Z_DEFAULT_COMPRESSION); diff --git a/t/10basic.t b/t/10basic.t index a4aed4c..6182dca 100644 --- a/t/10basic.t +++ b/t/10basic.t @@ -203,10 +203,10 @@ foreach my $class ('Data::FlexSerializer', 'Data::FlexSerializer::EmptySubclass' $res = $serializer->serialize($data{garbage}); 1; }; - if ($is_sereal) { - ok(!$eval_died, "Under Sereal we support serializing plain SvPV"); + if ($is_sereal or $s_name =~ /^(json|flex|default)/) { + ok(!$eval_died, "Under Sereal and JSON we support serializing plain SvPV"); } else { - ok($eval_died, "We should die under Storable and JSON when fed a plain SvPV"); + ok($eval_died, "We should die under Storable when fed a plain SvPV"); } }