X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Plugin.pm;h=80fa3892b81e68fcbaf1013a024cc009ee4473c0;hb=dd88e700bfcc92fc03db9d994ec747ca1c14ade7;hp=c693c44f2077612cb72cb0669208f521b0a3292c;hpb=2dd7bc5f80da4fe2220e28de1102641c239d084c;p=perl%2Fmodules%2Fre-engine-Plugin.git diff --git a/Plugin.pm b/Plugin.pm index c693c44..80fa389 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -5,7 +5,7 @@ use base 'Regexp'; use strict; use XSLoader (); -our $VERSION = '0.02'; +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;