[Templates-cvs] cvs commit: TT3/lib/Template/TT3 Tag.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Mon, 02 Feb 2004 10:02:26 +0000
cvs 04/02/02 10:02:26
Modified: lib/Template/TT3 Tag.pm
Log:
* added parse option to provide parse handler
Revision Changes Path
1.9 +12 -3 TT3/lib/Template/TT3/Tag.pm
Index: Tag.pm
===================================================================
RCS file: /template-toolkit/TT3/lib/Template/TT3/Tag.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Tag.pm 2004/01/28 16:17:50 1.8
+++ Tag.pm 2004/02/02 10:02:26 1.9
@@ -17,7 +17,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Tag.pm,v 1.8 2004/01/28 16:17:50 abw Exp $
+# $Id: Tag.pm,v 1.9 2004/02/02 10:02:26 abw Exp $
#
#========================================================================
@@ -29,7 +29,7 @@
use vars qw( $VERSION $DEBUG $ERROR $WARNING $TAG );
use base qw( Template::TT3::Base );
-$VERSION = sprintf("%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/);
$DEBUG = 0 unless defined $DEBUG;
$ERROR = '';
$TAG = {
@@ -181,6 +181,15 @@
sub parse {
my ($self, $textref, $handler, $match) = @_;
+
+ if (my $parse = $self->{ parse }) {
+ # call custom parse handler
+ eval {
+ $handler = &$parse($self, $textref, $handler, $match);
+ };
+ return $self->error($@) if $@;
+ }
+
return $handler;
}
@@ -774,7 +783,7 @@
=head1 VERSION
-$Revision: 1.8 $
+$Revision: 1.9 $
=head1 COPYRIGHT