package Text::Template::Preprocess;
+$Text::Template::Preprocess::VERSION = '1.56';
+# ABSTRACT: Expand template text with embedded Perl
+
+use strict;
+use warnings;
+
use Text::Template;
-@ISA = qw(Text::Template);
-$Text::Template::Preprocess::VERSION = 1.46;
+our @ISA = qw(Text::Template);
sub fill_in {
- my $self = shift;
- my (%args) = @_;
- my $pp = $args{PREPROCESSOR} || $self->{PREPROCESSOR} ;
- if ($pp) {
- local $_ = $self->source();
-# print "# fill_in: before <$_>\n";
- &$pp;
-# print "# fill_in: after <$_>\n";
- $self->set_source_data($_);
- }
- $self->SUPER::fill_in(@_);
+ my $self = shift;
+ my (%args) = @_;
+
+ my $pp = $args{PREPROCESSOR} || $self->{PREPROCESSOR};
+
+ if ($pp) {
+ local $_ = $self->source();
+ my $type = $self->{TYPE};
+
+ # print "# fill_in: before <$_>\n";
+ &$pp;
+
+ # print "# fill_in: after <$_>\n";
+ $self->set_source_data($_, $type);
+ }
+
+ $self->SUPER::fill_in(@_);
}
sub preprocessor {
- my ($self, $pp) = @_;
- my $old_pp = $self->{PREPROCESSOR};
- $self->{PREPROCESSOR} = $pp if @_ > 1; # OK to pass $pp=undef
- $old_pp;
+ my ($self, $pp) = @_;
+
+ my $old_pp = $self->{PREPROCESSOR};
+
+ $self->{PREPROCESSOR} = $pp if @_ > 1; # OK to pass $pp=undef
+
+ $old_pp;
}
1;
+__END__
-=head1 NAME
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
Text::Template::Preprocess - Expand template text with embedded Perl
=head1 VERSION
-This file documents C<Text::Template::Preprocess> version B<1.46>
+version 1.56
=head1 SYNOPSIS
One possible purpose: If your files contain a lot of JavaScript, like
this:
-
Plain text here...
{ perl code }
<script language=JavaScript>
Then use C<PREPROCESSOR =E<gt> \"e_scripts>. This will transform
-
-
=head1 SEE ALSO
L<Text::Template>
-=head1 AUTHOR
+=head1 SOURCE
+
+The development version is on github at L<https://https://github.com/mschout/perl-text-template>
+and may be cloned from L<git://https://github.com/mschout/perl-text-template.git>
+
+=head1 BUGS
+
+Please report any bugs or feature requests on the bugtracker website
+L<https://github.com/mschout/perl-text-template/issues>
+When submitting a bug or request, please include a test-file or a
+patch to an existing test-file that illustrates the bug or desired
+feature.
+
+=head1 AUTHOR
Mark Jason Dominus, Plover Systems
For updates, visit C<http://www.plover.com/~mjd/perl/Template/>.
-=head1 LICENSE
-
- Text::Template::Preprocess version 1.46
- Copyright 2013 Mark Jason Dominus
+=head1 COPYRIGHT AND LICENSE
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version. You may also can
- redistribute it and/or modify it under the terms of the Perl
- Artistic License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received copies of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+This software is copyright (c) 2013 by Mark Jason Dominus <mjd@cpan.org>.
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
=cut
-