dk has asked for the wisdom of the Perl Monks concerning the following question:

Omniscient monks,

Do you know of any modules that allow fiddling with SV magic? I'm playing now with mg_* and sv_magic* and thinking if there's already existing framework for it all. I don't want to reinvent the wheel, so I searched all over CPAN but found nothing.

In the unlikely case that there's indeed nothing written on the subject, I'll write it myself, but even in that case, I'd like to hear opinions first.

Replies are listed 'Best First'.
Re: Modules for magic
by ikegami (Patriarch) on Apr 11, 2007 at 13:36 UTC
Re: Modules for magic
by salva (Canon) on Apr 11, 2007 at 14:28 UTC
    From Perl, you can use Devel::Peek or B to inspect SVs with magic attached. But for most uses, the only way to access an SV magic is through the C API.

    Are you trying to do something specific or just investigating about the matter?

      Both actually. I'm curious if that be possible to somehow label each scalar a subroutine sees without storing the label in a separate hash, but on the scalar itself, using magic. Even if there is a non-magic way of doing that (which very well might be, I just doubt that), I'd be anyway interested in a common magic framework.