Text::Template

Text::Template is a Perl module to expand template text with embedded Perl.
Download

Text::Template Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mark Jason Dominus
  • Publisher web site:
  • http://search.cpan.org/~mjd/

Text::Template Tags


Text::Template Description

Text::Template is a Perl module to expand template text with embedded Perl. Text::Template is a Perl module to expand template text with embedded Perl.SYNOPSIS use Text::Template; $template = Text::Template->new(TYPE => 'FILE', SOURCE => 'filename.tmpl'); $template = Text::Template->new(TYPE => 'ARRAY', SOURCE => ); $template = Text::Template->new(TYPE => 'FILEHANDLE', SOURCE => $fh ); $template = Text::Template->new(TYPE => 'STRING', SOURCE => '...' ); $template = Text::Template->new(PREPEND => q{use strict;}, ...); # Use a different template file syntax: $template = Text::Template->new(DELIMITERS => , ...); $recipient = 'King'; $text = $template->fill_in(); # Replaces `{$recipient}' with `King' print $text; $T::recipient = 'Josh'; $text = $template->fill_in(PACKAGE => T); # Pass many variables explicitly $hash = { recipient => 'Abed-Nego', friends => , enemies => { loathsome => 'Bill Gates', fearsome => 'Larry Ellison' }, }; $text = $template->fill_in(HASH => $hash, ...); # $recipient is Abed-Nego, # @friends is ( 'me', 'you' ), # %enemies is ( loathsome => ..., fearsome => ... ) # Call &callback in case of programming errors in template $text = $template->fill_in(BROKEN => &callback, BROKEN_ARG => $ref, ...); # Evaluate program fragments in Safe compartment with restricted permissions $text = $template->fill_in(SAFE => $compartment, ...); # Print result text instead of returning it $success = $template->fill_in(OUTPUT => *FILEHANDLE, ...); # Parse template with different template file syntax: $text = $template->fill_in(DELIMITERS => , ...); # Note that this is *faster* than using the default delimiters # Prepend specified perl code to each fragment before evaluating: $text = $template->fill_in(PREPEND => q{use strict 'vars';}, ...); use Text::Template 'fill_in_string'; $text = fill_in_string( Requirements: · Perl


Text::Template Related Software