🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: csu.cs
Article #56

Re: perl require statement

#56
From: duggan dieterly
Date: Mon, 03 Apr 2000 00:00
23 lines
1654 bytes
Adam,

Use the @INC array to indicate where files are located.  See "Programming
Perl" page 138.

Adam Carheden <carheden@holly.ColoState.EDU> wrote:
: I've build a nice little library of perl routines for use in a web page I'm
: designing.  It was all working nicely, adding them using the line 

: require '../lib/functions.pl';

: because the page generating script was in a sub directory.  Then I added some
: stuff to one of the library files (functions.pl) in which IT used a require
: statement to include another file in the lib directory.

: require 'functions2.pl';

: This doesn't work, of course, becuase the actual script run by the webserver 
: is in /sitename/page.pl.  When run from the command line, functions.pl works
: fine becuase it's in the same directory as functions2.pl.  When called by 
: the page.pl, perl looks for /sitename/functions2.pl and, of course, doesn't
: find it.  Is there any way I can require functions2.pl in functions.pl without
: passing the location of page.pl to functions.pl as an argument?
Technical Details
Message-ID: <8cau13$foi@faure.cs.colostate.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <38e8e402@news.ColoState.EDU>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 148df6,36240e54cecdbac1
X-Google-Attributes: gid148df6,public
From: duggan dieterly <dieterly@cs.colostate.edu>
Subject: Re: perl require statement
Date: 2000/04/03
Message-ID: <8cau13$foi@faure.cs.colostate.edu>
X-Deja-AN: 606218594
Sender: dieterly@faure.cs.colostate.edu
References: <38e8e402@news.ColoState.EDU>
X-Trace: 3 Apr 2000 14:13:25 -0700, faure.cs.colostate.edu
Organization: Computer Science Department, Colorado State University
User-Agent: tin/pre-1.4-980226 (UNIX) (SunOS/5.7 (sun4m))
Newsgroups: csu.cs