+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.
--- #YAML:1.0
name: re-engine-Plugin
-version: 0.07
+version: 0.08
abstract: API to write custom regex engines
author:
- Vincent Pit <perl@profvince.com>
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
our ($VERSION, @ISA);
BEGIN {
- $VERSION = '0.07';
+ $VERSION = '0.08';
# All engines should subclass the core Regexp package
@ISA = 'Regexp';
require XSLoader;
=head1 VERSION
-Version 0.07
+Version 0.08
=head1 DESCRIPTION
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).
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/;
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 {