The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DDC::Format::Template - Template-based formatting for DDC hits

SYNOPSIS

 use DDC::Concordance;

 @hits = DDC::Client::Distributed->new()->query('foo&&bar'); ##-- get some hits

 $fmt = DDC::Format::Template->new(src=>$src,config=>\%cfg,vars=>\%vars);
 $str = $fmt->toString(\@hits);        ##-- conversion to string
 $fmt->toFile(\@hits,$filename);       ##-- output to file
 $fmt->toFh(\@hits,$fh);               ##-- output to filehandle

DESCRIPTION

Class for formatting DDC::Hit objects as perl code using the Template module.

Globals

Variable: @ISA

DDC::Format::Template inherits from DDC::Format.

Constructors, etc.

new
 $fmt = $CLASS_OR_OBJ->new(%args);

Accepted keywords in %args:

 (
  src         => $src,         ##-- template source (filename, fh, or string ref)
  config      => \%ttconfig,   ##-- see Template(3pm)
  vars        => \%vars,       ##-- extra vars
  tmpl        => $template,    ##-- Template object (overrides \%ttconfig)
 )

Default %ttconfig is:

 (
  INTERPOLATE => 1,
  PRE_CHOMP   => 0,
  POST_CHOMP  => 1,
  EVAL_PERL   => 1,
  ABSOLUTE    => 1,
 )
reset
 $fmt = $fmt->reset();

Resets the formatting object.

API

toString
 $str = $fmt->toString(\@hits);

Implements DDC::Format::toString().

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011-2016 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.