Subject: | Storable misinterprets scalars as globs. |
This issue happens with perl 5.10.x and any Storable newer than 2.20 (or even with older
ones.).
Storable uses its own way of finding the type of an SV instead of using perl's sv_reftype().
Sometimes it can misinterpret scalar values as globs and it will refuse to freeze/dclone them.
If SvTYPE(sv) returns SVt_PVGV Storable directly gives up, but the check for glob should be
more refined (see the attached patch) - this is exactly what Perl_sv_reftype() does:
...
case SVt_PVGV:
return (char *) (isGV_with_GP(sv)
? "GLOB" : "SCALAR");
...
In the case of Storable's sv_type() this translates to adding a check for SVt_PVGV:
...
#if PERL_VERSION >= 10
case SVt_PVGV:
return isGV_with_GP(sv) ? svis_OTHER : svis_SCALAR;
#endif
...
See for example this change:
http://www.nntp.perl.org/group/perl.perl5.changes/2008/06/msg21927.html
A lot of checks for globs are fixed there using isGV_with_GP().
Subject: | Storable.patch |
diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs
index 2741c7d..b3e9f7d 100644
--- a/ext/Storable/Storable.xs
+++ b/ext/Storable/Storable.xs
@@ -3482,6 +3482,10 @@ static int sv_type(pTHX_ SV *sv)
return svis_HASH;
case SVt_PVCV:
return svis_CODE;
+#if PERL_VERSION >= 10
+ case SVt_PVGV:
+ return isGV_with_GP(sv) ? svis_OTHER : svis_SCALAR;
+#endif
#if PERL_VERSION > 8
/* case SVt_BIND: */
#endif