in reply to Re^2: Introspection, strict, warnings and "defined"
in thread Introspection, strict, warnings and "defined"

I think it would be inefficient

It's essentially doing in C what you're doing in Perl, and it's not passing much data back and forth, so it's exactly the kind of optimization for which writing in C is a benefit. (If you're writing a preprocessor, you're also doing IO in a pipeline, so it's probably not an efficiency problem at all.)

With that said, an optimization on the Perl side is to use the orcish maneuver, but you have to be careful to distinguish between "Have I already checked and not found anything there?" and "Have I not checked at all." Even so you'll still have to perform the lookup in Perl or in C for every keyword occurrence if I understand your design correctly.


Improve your skills with Modern Perl: the free book.

  • Comment on Re^3: Introspection, strict, warnings and "defined"