re::engine::Hooks is a Perl module that provides a version of the Perl regexp engine that can call user-defined XS callbacks at the compilation and at the execution of each regexp node.
SYNOPSIS
In your XS file :
#include "re_engine_hooks.h"
STATIC void dri_comp_hook(pTHX_ regexp *rx, regnode *node) {
...
}
STATIC void dri_exec_hook(pTHX_ regexp *rx, regnode *node,
regmatch_info *info, regmatch_state *state) {
...
}
MODULE = Devel::Regexp::Instrument PACKAGE = Devel::Regexp::Instrument
BOOT:
{
reh_register("Devel::Regexp::Instrument", dri_comp_hook, dri_exec_hook);
}
In your Perl module file :
package Devel::Regexp::Instrument;
use strict;
use warnings;
our ($VERSION, @ISA);
use re::engine::Hooks; # Before loading our own shared library
BEGIN {
$VERSION = '0.01';
require DynaLoader;
push @ISA, 'DynaLoader';
__PACKAGE__->bootstrap($VERSION);
}
sub import { re::engine::Hooks::enable(__PACKAGE__) }
sub unimport { re::engine::Hooks::disable(__PACKAGE__) }
1;
In your Makefile.PL
use ExtUtils::Depends;
my $ed = ExtUtils::Depends->new(
'Devel::Regexp::Instrument' => 're::engine::Hooks',
);
WriteMakefile(
$ed->get_makefile_vars,
...
);
Product's homepage
Requirements:
· Perl