in reply to How to prevent references from stringifying?
For perl 5.8.5:
--- sv.c.org 2004-07-12 23:44:41.000000000 +0200 +++ sv.c 2004-10-03 16:54:08.000000000 +0200 @@ -3126,2 +3126,3 @@ } + Perl_croak(aTHX_ "Stringification of reference disallowed"); tsv = NEWSV(0,0);
This still allows stringification of compiled regexen, or when overloading is in place. If you want to disallow stringification in those cases too (so, for all references), you can instead do:
--- sv.c.org 2004-07-12 23:44:41.000000000 +0200 +++ sv.c 2004-10-03 16:56:34.000000000 +0200 @@ -3001,2 +3001,3 @@ SV* tmpstr; + Perl_croak(aTHX_ "Stringification of reference disallowed"); if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,string)) &&
UPDATE: Just in case you're unfamiliar with applying a patch: unpack the perl 5.8.5 source, save one of the above snippets as "patchfile", execute (in the unpacked perl dir) the following command: patch < path/to/patchfile and then compile perl normally
|
---|