Lines Matching refs:Template
2 # Text::Template.pm
12 package Text::Template;
13 $Text::Template::VERSION = '1.56';
26 my %GLOBAL_PREPEND = ('Text::Template' => '');
29 $Text::Template::VERSION;
284 $t = $GLOBAL_PREPEND{'Text::Template'};
474 Text::Template->fill_this_in($string, @_);
479 my $templ = Text::Template->new(TYPE => 'FILE', SOURCE => $fn, @_) or return undef;
536 $s =~ s/^Text::Template:://;
540 my $hash = $Text::Template::{ $s . "::" };
548 delete $Text::Template::{ $s . "::" };
610 Text::Template - Expand template text with embedded Perl
618 use Text::Template;
621 $template = Text::Template->new(TYPE => 'FILE', SOURCE => 'filename.tmpl');
622 $template = Text::Template->new(TYPE => 'ARRAY', SOURCE => [ ... ] );
623 $template = Text::Template->new(TYPE => 'FILEHANDLE', SOURCE => $fh );
624 $template = Text::Template->new(TYPE => 'STRING', SOURCE => '...' );
625 $template = Text::Template->new(PREPEND => q{use strict;}, ...);
628 $template = Text::Template->new(DELIMITERS => [$open, $close], ...);
665 use Text::Template 'fill_in_string';
673 use Text::Template 'fill_in_file';
677 Text::Template->always_prepend(q{use strict 'vars';});
727 use Text::Template;
729 my $template = Text::Template->new(SOURCE => 'formletter.tmpl')
730 or die "Couldn't construct template: $Text::Template::ERROR";
744 else { die "Couldn't fill in template: $Text::Template::ERROR" }
761 C<Text::Template> templates are programmed in I<Perl>. You embed Perl
769 =head2 Template Parsing
771 The C<Text::Template> module scans the template source. An open brace
787 If you have an unmatched brace, C<Text::Template> will return a
874 program fragment. It is private to C<Text::Template>, so
880 All C<Text::Template> functions return C<undef> on failure, and set the
881 variable C<$Text::Template::ERROR> to contain an explanation of what
883 that does not exist, C<$Text::Template::ERROR> will contain something like:
889 $template = Text::Template->new( TYPE => ..., SOURCE => ... );
892 C<undef> and sets C<$Text::Template::ERROR> if it can't create the
898 Text::Template->new( TYPE => 'FILE', SOURCE => $filename );
907 Text::Template->new( TYPE => 'STRING',
914 Text::Template->new( TYPE => 'ARRAY',
923 C<Text::Template> will read the text from the filehandle up to
927 Text::Template->new ( TYPE => 'FILEHANDLE',
961 Text::Template->new(
975 tell C<Text::Template> that a certain file is trustworthy by supplying
977 C<Text::Template> to disable taint checks on template code that has
1007 sets C<$Text::Template::ERROR>. If the template is already compiled,
1022 Otherwise, returns C<undef> and sets C<$Text::Template::ERROR>.
1192 option, C<Text::Template> loads the variables into the package you
1222 C<Text::Template> will invoke the function. This function is called
1224 C<Text::Template> what to do next.
1226 If the C<BROKEN> function returns C<undef>, C<Text::Template> will
1239 If you don't specify a C<BROKEN> function, C<Text::Template> supplies
1337 my $template = Text::Template->new(
1341 $template->fill_in(FILENAME => 'foo.txt') or die $Text::Template::ERROR;
1373 C<Text::Template> print out the text as it is generated instead of
1421 C<undef> and sets C<$Text::Template::ERROR> if it couldn't generate
1430 $text = Text::Template->fill_this_in( <<'EOM', PACKAGE => Q);
1443 in C<Text::Template>. You should use C<fill_in_string> instead. It
1450 C<Text::Template-E<gt>> in the example above. But I made the mistake
1454 not a method and you can omit the C<Text::Template-E<gt>> and just say
1463 use Text::Template 'fill_in_string';
1497 {Text::Template::_load_text(filename)}
1503 *Q::include = \&Text::Template::_load_text;
1513 \&Text::Template::_load_text> into the hash instead of importing it
1520 {Text::Template::fill_in_file(filename)}
1591 Lorenzo Valdettaro pointed out that if you are using C<Text::Template>
1659 C<Text::Template> version 1.22 and higher has a new feature to make
1697 Text::Template->always_prepend('perl statements');
1739 C<Text::Template> looks for these three things in order and takes the
1742 In a subclass of C<Text::Template>, this last possibility is
1743 ambiguous. Suppose C<S> is a subclass of C<Text::Template>. Should
1745 Text::Template->always_prepend(...);
1750 The C<always_prepend> value for C<Text::Template> is normally stored
1752 C<Text::Template>. When C<Text::Template> looks to see what text to
1756 looks in C<$GLOBAL_PREPEND{'Text::Template'}>. This means that
1759 Text::Template->always_prepend(...);
1766 your objects ignore C<Text::Template::always_prepend> calls by simply
1896 In C<Text::Template> beta versions, the backslash was special whenever
1903 In C<Text::Template> versions 1.00 through 1.10, there was a bug:
1929 because C<Text::Template> thinks that the code ends at the first C<}>,
1943 Starting with C<Text::Template> version 1.20, backslash processing is
1947 =head2 A short note about C<$Text::Template::ERROR>
1950 boundary' by examining a variable inside the C<Text::Template>
1951 package. Don't feel this way. C<$Text::Template::ERROR> is part of
1959 use Text::Template 'TTerror';
1961 my $template = Text::Template->new(SOURCE => $filename);
1969 use Text::Template;
1971 my $template = Text::Template->new(SOURCE => $filename)
1972 or die "Couldn't make template: $Text::Template::ERROR; aborting";
1976 =head2 Sticky Widgets in Template Files
1996 evaluated. See C<Text::Template::Preprocess> for more details.