in reply to overload =~ operator
Perls regex engine is very closely bonded to the perl internals, so writing a plug in replacement isnt going to be easy. However, as of Perl 5.9.5 it should be much easier, as the framework has been totally changed. In earlier versions of perl the swap of regex engines was interpreter wide, which meant that patterns compiled with one engine could and would be handed over to another for processing. As long as the engine being plugged in was just a "debug" build of the original this didnt lead to problems, but if you were to plug in a set of empty handlers all hell would break loose.
The new interface involves binding the internal structures with a dispatch table so that regexp's are executed using the same engine as they were compiled with. As abyproduct the use re 'debug'; pragma is now properly lexically scoped.
So the short of it is, its not easy to do, and requires advanced C/perl internals skills. However, in comparison to earlier perls it is actually possible.
One of my personal ambitions for 5.10 is to include a module that implements a plug in of another regex library. I dont know if ill acomplish it, but it is something id like to do.
|
|---|