John Crisp
2018-07-17 15:24:01 UTC
Well, I read the wiki, looked at a load of other files in he
/etc/e-smith hierarchy, and just cannot get this to work.
I have a file to process a set of fragments for multiple domains.
I want the calling file to pass the Domain to the fragment, per domain,
to create one conf file per domain.
Here's the calling file:
require esmith::DomainsDB;
my %Domains = esmith::DomainsDB->as_hash;
for (keys %Domains) {
my $domain = $_;
esmith::templates::processTemplate(
{
MORE_DATA => { THIS_DOMAIN => $domain },
TEMPLATE_PATH =>
'/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.conf',
OUTPUT_FILENAME =>
"/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.$domain.conf",
}
);
In the template fragment I have this:
my $domain = $THIS_DOMAIN;
$OUT = "SiteDomain=\"www." . $domain . "\"\n";
I also tried
$OUT = "SiteDomain=\"www." . $THIS_DOMAIN . "\"\n";
No matter what I do I get
Variable "$THIS_DOMAIN" is not imported
Program fragment delivered error <<Global symbol "$THIS_DOMAIN" requires
explicit package name
Frustratingly via my IDE I can see the THIS_DOMAIN gets set correctly ,
and puts that into @tmpl_vars[3] -> THIS_DOMAIN
But I get lost after that :-(
Anyone give me a clue what on earth I am doing wrong here? I know it is
stupidly simple,... but.....
B. Rgds
John
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.o
/etc/e-smith hierarchy, and just cannot get this to work.
I have a file to process a set of fragments for multiple domains.
I want the calling file to pass the Domain to the fragment, per domain,
to create one conf file per domain.
Here's the calling file:
require esmith::DomainsDB;
my %Domains = esmith::DomainsDB->as_hash;
for (keys %Domains) {
my $domain = $_;
esmith::templates::processTemplate(
{
MORE_DATA => { THIS_DOMAIN => $domain },
TEMPLATE_PATH =>
'/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.conf',
OUTPUT_FILENAME =>
"/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.$domain.conf",
}
);
In the template fragment I have this:
my $domain = $THIS_DOMAIN;
$OUT = "SiteDomain=\"www." . $domain . "\"\n";
I also tried
$OUT = "SiteDomain=\"www." . $THIS_DOMAIN . "\"\n";
No matter what I do I get
Variable "$THIS_DOMAIN" is not imported
Program fragment delivered error <<Global symbol "$THIS_DOMAIN" requires
explicit package name
Frustratingly via my IDE I can see the THIS_DOMAIN gets set correctly ,
and puts that into @tmpl_vars[3] -> THIS_DOMAIN
But I get lost after that :-(
Anyone give me a clue what on earth I am doing wrong here? I know it is
stupidly simple,... but.....
B. Rgds
John
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.o