summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template/CSV.pm
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-16 15:56:12 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-16 15:56:12 +0000
commit1781468582b9eac650f45c874134ed8a671bfdfe (patch)
tree1e6e595e08f444cfac18552f62eadfb2b2a8e473 /LedgerSMB/Template/CSV.pm
parentc24b6d1d47bf5d0bb2771067ba03955a5877201f (diff)
Add support for templates in string form
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1618 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Template/CSV.pm')
-rwxr-xr-xLedgerSMB/Template/CSV.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/LedgerSMB/Template/CSV.pm b/LedgerSMB/Template/CSV.pm
index bd06e478..9700a18a 100755
--- a/LedgerSMB/Template/CSV.pm
+++ b/LedgerSMB/Template/CSV.pm
@@ -75,6 +75,7 @@ sub process {
my $parent = shift;
my $cleanvars = shift;
my $template;
+ my $source;
my $output;
if ($parent->{outputfile}) {
@@ -82,6 +83,13 @@ sub process {
} else {
$output = \$parent->{output};
}
+ if (ref $parent->{template} eq 'SCALAR') {
+ $source = $parent->{template};
+ } elsif (ref $parent->{template} eq 'ARRAY') {
+ $source = join "\n", @{$parent->{template}};
+ } else {
+ $source = get_template($parent->{template});
+ }
$template = Template->new({
INCLUDE_PATH => $parent->{include_path},
START_TAG => quotemeta('<?lsmb'),
@@ -92,7 +100,7 @@ sub process {
}) || throw Error::Simple Template->error();
if (not $template->process(
- get_template($parent->{template}),
+ $source,
{%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs,
'escape' => \&preprocess},
$output, binmode => ':utf8')) {