Mike Cramer on 10 Oct 2003 20:33:49 -0000


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

Re: Perl source filter question


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

If it is, I missed where you said in what way it is smaller.

I guess it just feels smaller to me -- I don't need eval, I don't need to know which functions *are* called, just which functions *could be* called. It just felt smalled to me.


OK, so now I need to know:  what are you trying to accomplish that
isn't accomplished by this:

        grep 'select' *.pl *.pm


? Or maybe by:

perl -nle 'print "$ARGV: $_" if /select \( [^,)]* \)/x' *.pl *.pm

That looks for calls to 'select' that have fewer than two arguments.

Which is what I did, and solved my original problem. But at the same time, my grep turned up, not surprisingly, quoted strings containing stuff like "select total from db" and "please select one of the following". That's really what I was trying to prune away -- stuff that Perl would have known to ignore in it's parsing, but a one-off pattern match would have hit.


? What value are we trying to add to this?

I figured that Perl knows how to parse itself, so shouldn't it be able to give me a look at what it finds? But as you've pointed out, it is more difficult than that. I think my hope of a compile-time function list generator was significantly more complicated than the problem itself.


Thanks though for the help.

--
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**