Eric J. Roode on 10 Oct 2003 17:07:09 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Perl source filter question


On Fri, Oct 10, 2003 at 12:10:45PM -0400, Mike Cramer wrote:
> I'm looking for something along the lines of a perl source filter that 
> will take a source file -- cgi script, perl module, whatever -- and 
> without actually *running* the program, will list all of the functions 
> called. A script like this:

That's exceptionally difficult.  At one of his talks earlier this year,
Dominus gave an example of a line of code that would be parsed different
ways, depending on the phase of the moon!

If you are certain of the coding style used, you can make certain
assumptions, but if not, all bets are off.

    $io->print("foo");
    print $io "foo";
    $subref = 'CGI::param';
    $parm = $subref->('input');

Throw "eval" on top of that, and exporter, and symbol table manipulation,
and it's a real mess.  :-)

-- 
Eric J. Roode                                            sdn@comcast.net
$_ = reverse sort $/.r , qw p ekca ts lre reh
uJ p, map $_ . $" , qw e p h tona e and print

Attachment: pgp25wxrTQlGv.pgp
Description: PGP signature