Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Can a Perl module "inspect" itself and provide details about methods and parameters?

by LanX (Saint)
on Sep 22, 2019 at 17:13 UTC ( [id://11106549]=note: print w/replies, xml ) Need Help??


in reply to Can a Perl module "inspect" itself and provide details about methods and parameters?

Yes and no.

No ...Perl is so dynamic that you will hardly automatically parse all subs without an AI which is more clever than you.

But Yes ... you might built a solution which fits in 80-90 percent of the cases.

For instance is it allowed to dynamically proxy subs with AUTOLOAD and the way args are read from @_ can vary in many ways.

In the case of OO classes you'd also need to check the inheritance tree in @ISA.

And I don't even know which backdoors XS modules are allowed to use.

Saying so,after using a modul it's possible to dynamically introspect its Symbol Table Hash aka STASH.

And it's possible to list all lines involving the @_ array.

Something standard like my ($self,$name) = @_ might be easy to decipher.

But this will only show you the internal variable name and not the description of an argument $name.

Hence this would only be a semi automatic help often requiring human intervention.

But in your case, no way

From my experience with Image Magick this won't help much though, because the underlying C library is pretty inconsistent and Perl might only provide a thin layer.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re: Can a Perl module "inspect" itself and provide details about methods and parameters?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11106549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found