Click here to get back home

HowTo tell if from cmd_line || httpd

 HomeNewsGroups | Search

get this group's latest topics as an RSS feed  comp.lang.perl.misc - PERL programming language

please rate
this thread
If you were  Registered and logged in, you could reply and use other advanced thread options
Posted by ipellew on December 20, 2004, 5:05 pm
Hi all;

Whats a sure fire way to tell I am executed from either httpd or
command line? At the moment, I decide on HTTP_USER_AGENT having a
value to say I am from httpd.
This needs to work whatever the platform / server.

Regards
Ian



Posted by Alan J. Flavell on December 21, 2004, 4:13 am
On Tue, Dec 20, ipellew@pipemedia.co.uk inscribed on the eternal
scroll:



You can't, really, since anything you care to test could equally be
faked from the command line.



There's no absolute mandate to set that to a non-null value, so I'd
have to advise against that...

Seems to me that the closest specified item to what you're
asking for would be the GATEWAY_INTERFACE :

http://cgi-spec.golux.com/draft-coar-cgi-v11-03-clean.html#6.1.4



Indeed.  If you'd suggested otherwise, you'd have found yourself
contradicted ;-)

GATEWAY_INTERFACE -is- a bona fide feature of the CGI specification,
right from way back: http://hoohoo.ncsa.uiuc.edu/cgi/env.html

Any so-called CGI interface which fails to provide it would be
seriously deficient.  Of course, it could be faked from the command
line, as I mentioned before: but anyone who does that gets,
presumably, just what they asked for.

--
                   Procrastination gives you something to look forward
                           to putting off tomorrow.  -spotted on ahbou


Posted by Gregory Toomey on December 21, 2004, 1:46 pm
ipellew@pipemedia.co.uk wrote:



You could do that, or use the following (may not work in some platforms):

sub batch() {
        open(TTY, "/dev/tty");
        return 0 if tcgetpgrp(fileno(*TTY)) == getpgrp();
        return 1;
}

sub interactive {
        return !batch();
}

gtoomey



Subject Author Date
HowTo tell if from cmd_line || httpd ipellew 12-20-2004
|--> Re: HowTo tell if from cmd_line 12-21-2004_parent
`--> Re: HowTo tell if from cmd_line 12-21-2004_parent
If you were  Registered and logged in, you could reply and use other advanced thread options
  • Subject
  • Date

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

1-Script XML SitemapXML Sitemap
Privacy Policy