httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krist van Besien" <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] mod_perl and vhost configs
Date Wed, 20 Aug 2008 09:52:03 GMT
On Tue, Aug 19, 2008 at 17:58, Peter Milanese <milanesefamille@yahoo.com> wrote:

> Not so sure where this break is, or even if my config is done correctly. It
> seems to be pretty basic perl, of which I'm pretty veteran. Does anyone know
> what's going on ? Here's the code:

One thing I found out when implementing configs in perl is that you
have to declare all the variables you use as local, using "my"
statements. This because any global variable perl will try to match
against an apache directive with the same name.

Your problem is that you are not declaring your variables as local, so
your first statement:
"$s = Apache2::ServerUtil->server;"
results in perl looking for a directive "s" of type
"Apache2::ServerRec", which of course fails.

So write your perl sections as if you had "use strict;", and declare
all your variables local using "my", unless you want to directly pass
something to apache.
So use:
my $s = Apache2::ServerUtil->server;

You need to do this each time you introduce a local variable, eg:
 my   $hostname=hostname();
otherwise you will be setting the Apache directive to your hostname.

HTH,

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message