[Pdx-pm] Should be easy, but...

Eric Wilhelm scratchcomputing at gmail.com
Tue Oct 23 22:56:47 PDT 2007

# from Austin Schutz
# on Tuesday 23 October 2007 14:22:

>Ok, so all I want to know is what the path is to my cgi script. Sounds
>easy, but modperl changes $0 to /usr/sbin/apache2.

If you really need $0 and something changed that, then yes, you'll have 
to look in the environment (which will be specific to the environment 
(see also PAR.))

If you just want something relative to the current compilation unit, 
there's always __FILE__.  That is, if you're asking for $0 from within 
the main script, __FILE__ is the same -- and maybe closer to what you 

Probably an aside:  Anything looking at $0 from outside of the main 
script might smell like "action at a distance."

Entia non sunt multiplicanda praeter necessitatem.
--Occam's Razor

More information about the Pdx-pm-list mailing list