I’m new to mod_perl and I’m really enjoying it.  It has really improved performance.  Right now I’m just using Modperl::Registry to speed up things.  I have a question about showing graphics using a Perl Script and running it through mod_perl. 

 

Using Perl under regular CGI to create a dynamic web page I have always used:

 

print “<img src="\”thefile.jpg\”>”;

 

and this would display the graphic to the web page assuming that the file “thefile.jpg”  was in the same directory as the Perl script .  If the graphic was in another directory then something like:

 

print “<img src="\”../graphics/thefile.jpg\”>”;

 

was used.  Now that I’m using mod_perl and an Alias to my cgi-bin I’m having difficulties knowing how to reference the graphics file.  The following directive is in my httpd.conf file.

 

Alias /ssiweb/ "C:/Server/htdocs/develop/cgi-bin/"

<Location /ssiweb>

  SetHandler perl-script

  PerlResponseHandler ModPerl::Registry

  Options +ExecCGI

  PerlOptions +ParseHeaders

</Location>

 

It seems that the current working directory for the Perl scripts when run under mod_perl is in the bin directory where Apache.exe is.  I have considered using absolute paths but even that does not seem to work correctly with graphics.  I could also do something like:

 

print “<img src="\”http://www.mysite.com/graphics/thefile.jpg\”>”;

 

but it seems that there is a delay in displaying the graphic when I do this.

 

Where is the current working directory when running a Perl script under mod_perl. 

 

I would appreciate any help.

 

Thanks.

 

Reply via email to