Text::FillInText::FillIn.pm is a Perl class implementing a fill-in template. | |
Download |
Text::FillIn Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Ken Williams
- Publisher web site:
- http://search.cpan.org/~kwilliams/Module-Build-0.2808/lib/Module/Build/Compat.pm
Text::FillIn Tags
Text::FillIn Description
Text::FillIn.pm is a Perl class implementing a fill-in template. Text::FillIn.pm is a Perl class implementing a fill-in template.SYNOPSIS use Text::FillIn; # Set the functions to do the filling-in: Text::FillIn->hook('$', sub { return ${$_} }); # Hard reference Text::FillIn->hook('&', "main::run_function"); # Symbolic reference sub run_function { return &{$_} } $template = new Text::FillIn('some text with ] and ]'); $filled_in = $template->interpret(); # Returns filled-in template print $filled_in; $template->interpret_and_print(); # Prints template to currently # selected filehandle # Or $template = new Text::FillIn(); $template->set_text('the text is ]] ]]'); $TVars{'var1'} = 'two_'; $TVars{'var2'} = 'parter'; $TVars{'two_parter'} = 'interpreted'; $template->interpret_and_print(); # Prints "the text is interpreted" # Or $template = new Text::FillIn(); $template->get_file('/etc/template_dir/my_template'); # Fetches a file # Or $template = new Text::FillIn(); $template->path('.', '/etc/template_dir'); # Where to find templates $template->get_file('my_template'); # Gets ./my_template or # /etc/template_dir/my_templateThis module provides a class for doing fill-in templates. These templates may be used as web pages with dynamic content, e-mail messages with fill-in fields, or whatever other uses you might think of. Text::FillIn provides handy methods for fetching files from the disk, printing a template while interpreting it (also called streaming), and nested fill-in sections (i.e. expressions like ]ing1 ]] are legal).Note that the version number here is 0.04 - that means that the interface may change a bit. In fact, it's already changed some with respect to 0.02 (see the CHANGES file). In particular, the $LEFT_DELIM, $RIGHT_DELIM, %HOOK, and @TEMPLATE_PATH variables are gone, replaced by a default/instance variable system.I might also change the default hooks or something. Please read the CHANGES file before upgrading to find out whether I've changed anything you use. Requirements: · Perl
Text::FillIn Related Software