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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.