in reply to OOP introspection
That's a tougher one, because AFAIK does "classic Perl" only allow imports for "composition". Differing OO-frameworks might have differing approaches and builtin solutions for inspection.
But you can iterate over all subs in the namespace° of a class and inspect in which module it was originally defined.
There is a core module for that° Sub::Util (read the doc for subname ) ... or something like Sub::Identify from CPAN.
°) This won't help you if the composition was done by changing AUTOLOAD , but I don't even know if this approach is even a thing in OOP (?)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) sorry I was wrong about that, Sub::Util is not implementing what Sub::Identify does. But the latter comes with a compact pure Perl implementation using the B backend to extract those informations. AFAICS it's the same approach like described in the book "Perl Hacks".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OOP introspection (composition)
by LanX (Saint) on Apr 03, 2021 at 10:07 UTC |