[Pdx-pm] require './file' vs. require 'file'

Austin Schutz tex at off.org
Sun Jun 18 20:36:02 PDT 2006

On Sat, Jun 17, 2006 at 11:15:11AM -0700, Tom Phoenix wrote:
> On 6/16/06, Austin Schutz <tex at off.org> wrote:
> >        In the code there is:
> >
> >require './my_lib.pl';
> >
> >        where ./my_lib.pl is a symlink to ../my/my_lib.pl.
> >        The full path to the actual file is:
> >
> >/usr/local/apache/cgi-bin/my/my_lib.pl
> This is a red flag: The CGI spec fails to specify the current working
> directory used when a CGI program is invoked, alas. So I'm obliged to
> say that these relative paths may not resolve in the obvious way.

	The part that I can't figure out (but forgot to mention) is that
either way it is loading the same file (verified by inserting test output).
So I'm guessing that is causing some odd issue of being loaded at the
"correct" time.

> Could it also, separately, be loading './my_lib.pl'? Normally, require
> won't load the same library twice; but it can if the code asks for it
> under different names. Check %INC at runtime to see what actually
> loaded.

	I'm not sure. But I can't figure out how it would matter if they
are inherently the same file.


More information about the Pdx-pm-list mailing list