Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Running Perl scripts from a single CGI-BIN, on a multiple-virtual hosting server

by c (Hermit)
on Oct 02, 2001 at 19:41 UTC ( [id://116154]=note: print w/replies, xml ) Need Help??


in reply to Running Perl scripts from a single CGI-BIN, on a multiple-virtual hosting server

I've found myself in a very similar situation to your own, and headed down the same path. In the end, I decided that coming up with a global configuration file that each globally accessible script could pull from was just not the solution I was looking for. After all, some scripts just needed a small bit of tweaking to make them usable by all virtual hosts on my machine. Instead, I took the approach of tweaking each script such that it would be globally usable without further editing by end users, and hopefully in a manner that would allow the script to avoid further editing as new domains were placed on the machine.

My small case in point is something that I think you referred to in your post, a formmail script.

The script relies on checks against the $ENV{'HTTP_REFERER'} variable and provides an array that can hold the various domains on your machine. To make the script globally accessible without having to update it per domain, I rewrote the array to pull all local domains from already existing file like /etc/mail/sendmail.cw or perhaps your zone files from dns.

Regardless of how you do it, chances are that each script just needs a small rewrite to bring it up to speed as globally accessible. I am far from being a monk with major perl-fu power, but it certainly fit my needs and took very little time to do.

my @referers; open(FH, "/etc/mail/sendmail.cw") or die "Cant open $i! : $!\n"; while(<FH>) { chomp; my $www = "www.$_"; push(@referers, $_); push(@referers, $www); } close(FH); }

humbly -c

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://116154]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found