Thank you - I didn't know about can. I could get by with it, but I think it would be inefficient. I am not planning more than 15-20 extensions, but each one might come up many times. I would therefore have to test each keyword candidate for every occurrence, which seems inelegant to me, or make an entry in a table every time I found one, which would complicate the code, possibly beyond my ability to keep it bug free. But I will look into can, as it might well be what I need.
Regards,
John Davies
| [reply] [d/l] [select] |
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.
| [reply] |