[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Another Question -- about "including"



On Thu, Apr 13, 2000 at 09:42:11AM -0400, Ronald J Kimball wrote:
> On Thu, Apr 13, 2000 at 08:37:28AM -0400, Ricky Morse wrote:
> > Hi!  I have another question....
> > 
> > I am working on a .cgi that I am trying to make extensible.  It is a very 
> > complex .cgi, and I would like to be able to split it across many files.  
> > There are two things I would like to do for this:
> > 
> > 1) Is there some equivalent of C's "include"?  "use" says that it must 
> > take a bareword -- ie, it looks for something in @INC.  I would like to 
> > be able to reference code in files that are in the same directory as the 
> > .cgi, or some subdirectory thereof.
> 
> @INC generally includes the current directory at the end.  You can add the
> current directory explicitly with:
> 
> use lib '.';
> 
> which will add the current directory to the beginning of @INC.

I should add that the current directory may not be the same as the
directory containing the CGI script.  You can use the FindBin module to get
the directory containing the script.

Ronald


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org