X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Plugin.git;a=blobdiff_plain;f=Plugin.pm;h=80fa3892b81e68fcbaf1013a024cc009ee4473c0;hp=220dfdfd9b94ebb9fc6340e2b95d15563d98171d;hb=dd88e700bfcc92fc03db9d994ec747ca1c14ade7;hpb=447aa9bcb55632cf669454868679169602a28fe2 diff --git a/Plugin.pm b/Plugin.pm index 220dfdf..80fa389 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -5,7 +5,7 @@ use base 'Regexp'; use strict; use XSLoader (); -our $VERSION = '0.03'; +our $VERSION = '0.04_01'; XSLoader::load __PACKAGE__, $VERSION; @@ -26,7 +26,7 @@ sub import my ($pkg, %sub) = @_; # Valid callbacks - my @callback = qw(comp exec intuit checkstr free dupe); + my @callback = qw(comp exec); #intuit checkstr free dupe); for (@callback) { next unless exists $sub{$_}; @@ -83,4 +83,15 @@ sub num_captures } } +sub named_captures +{ + my ($re, %callback) = @_; + + for my $key (keys %callback) { + $key =~ y/a-z/A-Z/; # ASCII uc + my $name = '_named_capture_buff_' . $key; + $re->$name( $callback{$key} ); + } +} + 1;