Skip to content
Permalink
Browse files

More template variable pruning. You should just use the config object.

  • Loading branch information...
perlDreamer committed Jan 7, 2012
1 parent dd81abc commit 662e341e793ebc55038104871e76ef1ba4a9cedf
Showing with 2 additions and 8 deletions.
  1. +1 −7 wre/lib/WRE/File.pm
  2. +1 −1 wre/t/File.t
@@ -313,8 +313,7 @@ Either a path to a template file as a scalar or a scalar reference to a template
=head3 vars
A hash reference containing the template variables to process on the template. The following template variables
are automatically generated and added to the list: databaseHost, databasePort, nginxPort, starmanPort,
domainRoot, wreRoot, webguiRoot
are automatically generated and added to the list: domainRoot, wreRoot, webguiRoot, config.
=cut

@@ -331,13 +330,8 @@ sub processTemplate {

# add in some template template variables
$var->{config} = $config;
$var->{databaseHost} = $config->get("mysql/hostname");
$var->{databasePort} = $config->get("mysql/port");
$var->{nginxPort} = $config->get("nginx/port");
$var->{starmanPort} = $config->get("starman/port");
$var->{domainRoot} = $config->getDomainRoot;
$var->{wreRoot} = $config->getRoot;
$var->{wreUser} = $config->get("user");
$var->{webguiRoot} = $config->getWebguiRoot;

# cache template
@@ -87,7 +87,7 @@ is(-f file($recursiveDir2."/ab/a")->stringify, 1, "recursive copy() subdirectory


# processTemplate
my $content = "This is my starmsn port: [% starmanPort %].";
my $content = "This is my starmsn port: [% config.get('starman/port') %].";
my $evaluatedContent = "This is my starman port: 8081.";
is(${$file->processTemplate(\$content)}, $evaluatedContent, "processTemplate() with scalarref");

0 comments on commit 662e341

Please sign in to comment.
You can’t perform that action at this time.