Because if I have 'tinytext' in the list, then the type returned is { type => 'tinytext' }, and that's invalid. I need both TEXT() and TINYTEXT() to return a type of 'text', but the error message needs to report the actual subroutine called. If this were a one-off, I wouldn't care. However, I need multiple aliases which return identical types but whose error message needs to return which alias was called.
Update: I know it's easy to modify the generator to do this and that's what I'll do (a hash mapping instead of a list). It just bugs me that if an anonymous sub is assigned to a CODE slot in a type glob and I call the actual sub, I can't figure out which one it is.
| [reply] |
It just bugs me that if an anonymous sub is assigned to a CODE slot in a type glob and I call the actual sub, I can't figure out which one it is.
That's because you don't call, it - perl does. You just name it... ;-) But then, I guess there is a way with some XS devilry involved. Devel::Peek's "CvGV($cv)" returns one of the globs associated to a subroutine reference, so I deem it possible to get at the right one. Haven't got time right now to find out how Ilya did it.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
| [reply] |
Have you considered asking stvn if Moose provides this information? I know he was doing a lot of work early on in providing appropriate meta-information for subroutines and methods.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] |