[Templates-cvs] cvs commit: TT3/lib/Template/Directive My.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Wed, 01 Dec 2004 11:15:31 +0000
cvs 04/12/01 11:15:31
Added: lib/Template/Directive My.pm
Log:
* added MY directive
Revision Changes Path
1.1 TT3/lib/Template/Directive/My.pm
Index: My.pm
===================================================================
#========================================================================
#
# Template::Directive::My
#
# DESCRIPTION
# The MY directive.
#
# AUTHOR
# Andy Wardley <abw@wardley.org>
#
# COPYRIGHT
# Copyright (C) 1996-2004 Andy Wardley. All Rights Reserved.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# REVISION
# $Id: My.pm,v 1.1 2004/12/01 11:15:30 abw Exp $
#
#========================================================================
package Template::Directive::My;
use strict;
use warnings;
use Template::Directive;
use base qw( Template::Directive );
our $VERSION = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/);
our $DEBUG = 0 unless defined $DEBUG;
our $ERROR = '';
our $KEYWORD = 'MY';
sub parse {
my ($self, $textref, $handler, $match) = @_;
my ($expr, @exprs);
my $parser = $match->{ parser }
|| return $self->error('no parser defined');
while ($expr = $parser->parse_assign($textref, $match)) {
push(@exprs, $expr);
}
if (@exprs) {
return $handler->expr([ my => @exprs ])
|| return $self->error($handler->error());
}
else {
return $self->error( 'missing assignment(s) after ',
$self->keyword($match) );
}
}
1;
__END__
=head1 NAME
Template::Directive::My - the MY directive
=head1 SYNOPSIS
# TODO
=head1 DESCRIPTION
# TODO
=head1 METHODS
=head2 new()
# TODO
=head1 AUTHOR
Andy Wardley E<lt>abw@wardley.orgE<gt>
=head1 VERSION
$Revision: 1.1 $
=head1 COPYRIGHT
Copyright (C) 1996-2004 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
# Local Variables:
# mode: perl
# perl-indent-level: 4
# indent-tabs-mode: nil
# End:
#
# vim: expandtab shiftwidth=4: