Very much so. I've started this at least two or three times at this
point, but gotten bogged down in all of the suprising edge cases every
time. gv_fetchpvn_flags really needs to be at least three different
functions - one for finding the appropriate stash to use for the
variable being looked up, one for creating the actual gv (this is
basically already split out into gv_init), and one for applying the
appropriate magic to a glob, given its name and stash.
Actually doing this split, however, is annoyingly tricky, due to the
amount of interweaved logic strewn throughout various parts of the
function (short-circuit "return NULL"s in the "find a stash" portion and
the many different meanings of addmg being two of the more irritating
bits). Maybe I'll give it another shot one of these days, but I very
much wouldn't mind somebody else doing it either.
This function is one of the main blockers to anonymous stashes being
usable throughout the core - they're already mostly usable everywhere,
because everything else that uses stashes uses the HV* directly, but
there's no real way to add things to them without manually constructing
globs, since the only interface we have requires the fully qualified
variable name. If this was split up such that I could just call gv_init,
gv_magicalize (or whatever some new function is called), and hv_store,
and have things just work properly, that would be pretty great.
-doy