Mike Cramer on 10 Oct 2003 19:47:55 -0000


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

Re: Perl source filter question


Mark Dominus wrote:
Eric Roode said it was exceptionally difficult to solve this, but that
wasn't strong enough.  It is impossible.  There is a mathematical
proof that there's no solution; it's called "Rice's theorem".  But the
content of the theorem is completely unsurprising: there are no
shortcuts to computation; if you want to know the result of computing
something, you actually have to compute it.

Yes...this is obviously true, but luckily the problem I'm trying to solve is much smaller.


There's a big technical difficulty with your question, since from
Perl's point of view, built-in functions like 'print' and 'sleep' are
not the same kind of thing as used-defined functions like 'CGI::new'
and 'CGI::header'.  And, even worse, 'use' and 'my' are not functions
at all.  It's not even clear to me why you want the output to include
'use' and 'my', but not '->' (which is known internally inside Perl as
'pp_method') or '==' or 'qq' or '='.

Plain and simple ignorance...I was basically thinking of functions as anything in "Functions" chapter of Programming Perl, plus anything imported from another module. As you might have guessed, I'm not *really* interested in 'use' or 'my'.


The B:: modules can't see at compile time that the code will run the
'sleep' operator at run time.  The only way to find out what a program
will do if you run it, is to actually run it.  If there were a
shortcut to computation, then we wouldn't actually need to compute,
and then we'd all be out of a job.

I hope this was more helpful than frustrating.  It would help to know
more about what you are actually trying to accomplish and why.

I might as well come clean. It's very simple: someone I work with wrote some Apache::Registry scripts that use the one-arg form of "select" to write out files on the webserver, but neglected to restore the originally selected filehandle. So the immediate question was, "What other scripts are calling select?"


But I figured, why not try to find something a little more generic? Basically, something that can tell me which scripts contained references to, say, Digest::MD5::md5hash? I understand that eval is going to be impossible without actually running the program, and that's fine. I picture it as more of a basic dependency analysis -- although as you pointed out, internal functions wouldn't be "dependencies" in the same way that functions from an external module are. And, ultimately, with AUTOLOAD and everything, even the existance of method calls might not be verifiable until runtime. I don't need to know what *will* be called, just what *might* be called.

--
Mike Cramer
http://www.webkist.com/ | AIM: MikeWebkist

-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**