Hans Dieter Pearcey on 10 Oct 2003 20:44:40 -0000


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

Re: Perl source filter question


On Fri, Oct 10, 2003 at 04:33:39PM -0400, Mike Cramer wrote:
> 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.

Jupiter is a lot smaller than the sun, but they're both still huge
compared to a rock.

Even a really big rock, or a relatively complex pattern match.

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

If you had really used the pattern mjd gave above, you wouldn't have
gotten things like "select total from db" and "please select".  (Maybe
you put your response in the wrong place.)

For what it's worth, I had to do something very similar about 6 months
ago, and it was really far easier to use the 'stupid' solution (pattern
matching, refining the pattern until it only hit the things I actually
happened to have) than the 'smart' one (finding out which functions are
called).

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