Skip to content

Commit

Permalink
More template variable pruning. You should just use the config object.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Jan 7, 2012
1 parent dd81abc commit 662e341
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions wre/lib/WRE/File.pm
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wre/t/File.t
Expand Up @@ -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");

Expand Down

0 comments on commit 662e341

Please sign in to comment.