Adym Lincoln wrote:

> Hi all,
> 
> I have two questions...
> 
> 1. I am using Perl along with CGI to develop some basic data capture screens...The 
> development and production servers are using different web servers, one IIS, the 
> other Apache.  AND (not surprisingly) they don't have the same cwd()...IIS is 
> /inetpub/wwwroot, Apache is ./cgi-bin/.  I'd like to find a way to either a.) detect 
> what type of web-server is running and adjust accordingly OR b.) get advice on how 
> others have managed this type of arrangement.

You can use the Cwd module to determine where you are.

> 2. In conjunction with the above question, I have a handful of custom modules that 
> need to be installed *locally* within my cgi-bin directory.  I have limited access 
> on the <target> server, so the modules are being installed at /cgi-bin/inc...My 
> question is, how do I setup my use statements to access these...currently, I am hard 
> coding the directory path as so...

It's best if you put the modules directly in cgi-bin and add dirs
to match the path (eg: XML::Parser would go in ../cgi-bin/XML/Parser.pm).
That way since . is on your path, they will be picked up automatically.

In the case of that stupid IIS, I would do a chdir to the cgi-bin dir
and keep things the same.  Then the lines below (commented out) should
work fine or you could use require (and maybe import) instead of use to
delay the loading till after you chdir (or you can do the chdir in a
BEGIN block so it gets done before the use's).

use Cwd;
my $dir = getcwd;
if ($dir !~ /cgi-bin$/) {       # if not in cgi-bin
        chdir <to wherever cgi-bin is on IIS>;
}
require FileHandle;     # import if necessary

> <snip>
> #use strict;           # used to explicitly declare variables...
> use Getopt::Std; 
> use Cwd;
> #use FileHandle;
> #use XML::Parser;
> #use XML::Simple;
> #use XML::Writer;
> #use Data::Dumper;
> 
> # <crev> 1.1.0; ASL; 03/03/2003;
> use lib '/inetpub/wwwroot/maine-maid/dev/cgi-bin';
> use inc::Xception;
> use inc::Log;
> use inc::Config;
> # </crev>
> 
> #/**************************************************************\
> # DEPENDENCIES      : End
> #\**************************************************************/
> </snip>
> 
> This works, but in the end, when I install these on the Apache server, I end up 
> having to edit the use lib line and place the directory path in place...


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to