From 8d06e08c4f7bbcd6ede7e25da37c216be42278e5 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Sat, 8 Nov 2008 18:31:09 +0000 Subject: [PATCH] Make sure PerlIO::via doesn't leave its old GV's hanging in the stash they were created in. Steal the idea from IO::File to just delete the stash entry after creating the GV. This fixes perl #59268. p4raw-id: //depot/perl@34779 --- ext/PerlIO/via/via.pm | 2 +- ext/PerlIO/via/via.xs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/PerlIO/via/via.pm b/ext/PerlIO/via/via.pm index f7ab749..6ff804e 100644 --- a/ext/PerlIO/via/via.pm +++ b/ext/PerlIO/via/via.pm @@ -1,5 +1,5 @@ package PerlIO::via; -our $VERSION = '0.06'; +our $VERSION = '0.07'; use XSLoader (); XSLoader::load 'PerlIO::via'; 1; diff --git a/ext/PerlIO/via/via.xs b/ext/PerlIO/via/via.xs index 5e6ddd3..e50052c 100644 --- a/ext/PerlIO/via/via.xs +++ b/ext/PerlIO/via/via.xs @@ -91,6 +91,10 @@ PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV ** save, int flags, GvIOp(gv) = newIO(); s->fh = newRV((SV *) gv); s->io = GvIOp(gv); + if (gv) { + /* shamelessly stolen from IO::File's new_tmpfile() */ + hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); + } } IoIFP(s->io) = PerlIONext(f); IoOFP(s->io) = PerlIONext(f); -- 2.7.4