From: Vincent Pit Date: Sat, 29 Aug 2009 16:53:28 +0000 (+0200) Subject: This is 0.08 X-Git-Tag: v0.08^0 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Plugin.git;a=commitdiff_plain;h=37642baad6c2d95e8a557017d221496095053def This is 0.08 --- diff --git a/Changes b/Changes index d72082c..5fe0225 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,19 @@ +0.08 2009-08-29 16:55 UTC - Vincent Pit + + Add : The new ->callbacks method to the regexp object let you specify + the 'exec' callback on an individual basis. + + Chg : Perl 5.10 is now required (instead of 5.9.5). + + Fix : The pragma was leaking into required scopes on 5.10.0. + + Fix : If you specified a different re::engine::Plugin between the + compilation and the execution of a regular expression, the + 'exec' callback invoked used to be the one for the second + engine. Worse, if the original engine wasn't in scope at the + time of execution, nothing happened. This is now fixed. + + Fix : The reference count of the callbacks stored wasn't properly + decremented. + + Fix : Incomplete MANIFEST. + + Tst : Subdirectories are now ordered. + + Tst : Author tests. + 0.07 2009-08-23 09:30 UTC - Vincent Pit + Fix : [perl #38684]: test failures in t/method/mod.t + Fix : Building with blead. diff --git a/META.yml b/META.yml index e57f990..9f2555d 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: re-engine-Plugin -version: 0.07 +version: 0.08 abstract: API to write custom regex engines author: - Vincent Pit @@ -12,7 +12,7 @@ build_requires: ExtUtils::MakeMaker: 0 Test::More: 0 requires: - perl: 5.009005 + perl: 5.01 XSLoader: 0 resources: bugtracker: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=re-engine-Plugin diff --git a/Plugin.pm b/Plugin.pm index a641a81..df2a9f6 100644 --- a/Plugin.pm +++ b/Plugin.pm @@ -6,7 +6,7 @@ use strict; our ($VERSION, @ISA); BEGIN { - $VERSION = '0.07'; + $VERSION = '0.08'; # All engines should subclass the core Regexp package @ISA = 'Regexp'; require XSLoader; diff --git a/Plugin.pod b/Plugin.pod index 227dca3..7b30d98 100644 --- a/Plugin.pod +++ b/Plugin.pod @@ -4,7 +4,7 @@ re::engine::Plugin - API to write custom regex engines =head1 VERSION -Version 0.07 +Version 0.08 =head1 DESCRIPTION diff --git a/README b/README index 9da0ecf..7ab7785 100644 --- a/README +++ b/README @@ -1,6 +1,9 @@ NAME re::engine::Plugin - API to write custom regex engines +VERSION + Version 0.08 + DESCRIPTION As of perl 5.9.5 it's possible to lexically replace perl's built-in regular expression engine with your own (see perlreapi and perlpragma). @@ -113,6 +116,9 @@ CALLBACKS routine should return a true value if the match was successful, and a false one if it wasn't. + This callback can also be specified on an individual basis with the + "callbacks" method. + METHODS str "str" ~~ /pattern/; @@ -167,6 +173,31 @@ METHODS The length specified will be used as a a byte length (using SvPV), not a character length. + nparens + gofs + callbacks + # A dumb regexp engine that just tests string equality + use re::engine::Plugin comp => sub { + my ($re) = @_; + + my $pat = $re->pattern; + + $re->callbacks( + exec => sub { + my ($re, $str) = @_; + return $pat eq $str; + }, + ); + }; + + Takes a list of key-value pairs of names and subroutines, and replace + the callback currently attached to the regular expression for the type + given as the key by the code reference passed as the corresponding + value. + + The only valid key is currently "exec". See "exec" for more details + about this callback. + num_captures $re->num_captures( FETCH => sub {