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

Austin Schutz tex at off.org
Tue Oct 23 16:20:30 PDT 2007

On Tue, Oct 23, 2007 at 02:22:16PM -0700, Austin Schutz wrote:
> 	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.
> 	Some random postings on the web indicate FindBin or FindBin::Real.
> Perfect, even supposed to work with modperl. Ok, here we go.. ah...
> Bin: /usr/sbin, Script: apache2, Realbin: /usr/sbin. Super.
> 	This should be taking 10 seconds, instead I've wasted the better part
> of a day trying to figure this out. Surely I must be missing something
> obvious, yes? Shouldn't the path to the currently executing script be simple
> to find, like maybe even in the perl core simple?

	Of course! There's a cgi environment variable for it:
$ENV{SCRIPT_FILENAME}. So all I need to do is take the filename off the
end and use lib $that.

	..but mod_perl doesn't respect begin blocks, so I can't tweak the
name and put it in a use lib. I know! I'll make a symlink to the current
directory named $ENV{SCRIPT_FILENAME}foo, then use lib
"$ENV{SCRIPT_FILENAME}foo/lib/perl" so I can find my modules.

	Am I the only one who runs into this stuff? Does mod_python do
this nonsense?


More information about the Pdx-pm-list mailing list