Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
While we are still not exactly there with Padre but I would like to get your opinion on the issue.

Given a Perl script or a module or a class, how can one find the list of all the functions? Given an object - assuming I know which class it belongs to - how can one find out which methods are available to it?

I know the simple case is finding all the sub blabla {} entries and the general case cannot be solved and that I should use PPI for this anyway.

Can we define rules that assuming them we can find all the functions? Can we find better proximations?

For example:

  • If I have string eval in my code I know there can be anything injected.
  • If I use Class::Accessor then I can look for mk_accessors that will reveal the extra methods I have.
So what else should I check?

I know even if we collect all the method generator modules that are currently available on CPAN and support it, someone will upload a new one. But then we can just add support for that too.

So what virtual function generators are there?

What other kind of code (besides string eval) can generate methods on the fly? Can we recognize them in a reasonable way?

Update

After seeing the response of ikegami I see I have to make it clear I meant that I'd like to do it without running the code although, it might also be a good strategy to try to run code and get the information that way. The only problem can be with the source code of a missile launcher that might start the count-down in a BEGIN block.

In reply to How to find all the available functions in a file or methods in a module? by szabgab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found