CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
server variables



Nov 2, 2000, 6:59 PM

Post #1 of 4 (775 views)
server variables Can't Post

I am trying to make my script easier to move from server to server. Here is what i have so far:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

$cgiurl = $ENV{'SCRIPT_NAME'};
$dataurl = `pwd`;
@mailprog = `whereis sendmail`;
foreach $mail_prog (@mailprog) {
$mail_prog =~ s/\s+\S+\.\S+//gi;
($header, $mailprog) = split (/\s/,$mail_prog);
Everything is working on my server. but my question is about sendmail. "whereis sendmail" gives an output like this:

sendmail: usr/sbin/sendmail etc/ usr/lib/sendmail

is this a pretty much standard output?
i split it by spaces $header being "sendmail:" and $mailprog being "/usr/sbin/sendmail"
i pretty much ignored everything else.... any ideas/suggestions/comments?

Enthusiast / Moderator

Nov 2, 2000, 7:50 PM

Post #2 of 4 (775 views)
Re: server variables [In reply to] Can't Post

Yes that is correct,

$mailprog = `whereis sendmail`;
($tmp, $path, $path2, $path3)=split(/\s/, $mailprog);
print "$path";

Also will get you the first given path. The three paths all are different places sendmail is on your server. I got the same result.



Nov 2, 2000, 8:00 PM

Post #3 of 4 (775 views)
Re: server variables [In reply to] Can't Post

is it neccisary to get all the other paths?

$mail_prog =~ s/\s+\S+\.\S+//gi;
goes ahead and 'ignores' a variable if it contains a period ".", so only the actual paths are loked at, would there be any other reason to keep the other locations?

Enthusiast / Moderator

Nov 3, 2000, 1:54 AM

Post #4 of 4 (775 views)
Re: server variables [In reply to] Can't Post

I don't think so,

The first one that comes up, since it's all given by the server, it will always work. I'd use the first path given by the server.



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives