X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Plugin.pod;h=4bb2674022e294bd3e335abea4c0141a8d901c7b;hb=686fea1f34b041af100934b062781594ee5bc8b5;hp=3ae9882d8bcd5ff26cbd5663f3ccfae1e9e916ab;hpb=447aa9bcb55632cf669454868679169602a28fe2;p=perl%2Fmodules%2Fre-engine-Plugin.git
diff --git a/Plugin.pod b/Plugin.pod
index 3ae9882..4bb2674 100644
--- a/Plugin.pod
+++ b/Plugin.pod
@@ -19,12 +19,12 @@ C or runtime for C patterns, or something inbetween
depending on variable interpolation etc.
When this module is loaded into a scope it inserts a hook into
-C<$^H{regcomp}> (as described in L) to have each regexp
-constructed in its lexical scope handled by this engine, but it
-differs from other engines in that it also inserts other hooks into
-C<%^H> in the same scope that point to user-defined subroutines to use
-during compilation, execution etc, these are described in
-L below.
+C<$^H{regcomp}> (as described in L and L) to
+have each regexp constructed in its lexical scope handled by this
+engine, but it differs from other engines in that it also inserts
+other hooks into C<%^H> in the same scope that point to user-defined
+subroutines to use during compilation, execution etc, these are
+described in L below.
The callbacks (e.g. L) then get called with a
L object as their first argument. This object
@@ -51,7 +51,7 @@ caller's scope use use the following snippet:
sub import
{
- # Populates the caller's %^H with our callbacks
+ # Sets the caller's $^H{regcomp} his %^H with our callbacks
re::engine::Plugin->import(
comp => \&comp,
exec => \&exec,
@@ -122,6 +122,9 @@ available as the second argument (C<$str>) and through the L
method. The 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
+L method.
+
=head1 METHODS
=head2 str
@@ -182,6 +185,33 @@ called at all.
The length specified will be used as a a byte length (using
L), not a character length.
+=head2 nparens
+
+=head2 gofs
+
+=head2 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 C. See L for more details about
+this callback.
+
=head2 num_captures
$re->num_captures(
@@ -391,13 +421,17 @@ Please report any bugs that aren't already listed at
L to
L
-=head1 AUTHOR
+=head1 AUTHORS
+
+Evar ArnfjErE Bjarmason C<< >>
-Evar ArnfjErE Bjarmason
+Vincent Pit C<< >>
=head1 LICENSE
-Copyright 2007 Evar ArnfjErE Bjarmason.
+Copyright 2007-2008 Evar ArnfjErE Bjarmason.
+
+Copyright 2009 Vincent Pit.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.