pbeckingham has asked for the wisdom of the Perl Monks concerning the following question:
I don't know what the best approach would be to allow the following:
I would like a program P to use a module M.pm, and they currently (and always will) reside together in the same directory. I would like to be able to rename that directory and have it still work. I would also like to be able to run P from an arbitrary location, such that $CWD is not predictable. The code below does not satisfy these two requirements.
Here is the program that resides in ~/P:
and here is the module 'M' that resides in ~/M.pm:#! /usr/bin/perl -w use strict; use M; my $m = M->new;
I have considered:package M; sub new {1}; 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Relative Module Path
by duff (Parson) on Aug 01, 2004 at 03:05 UTC | |
by BrowserUk (Patriarch) on Aug 01, 2004 at 03:18 UTC | |
|
Re: Relative Module Path
by tadamec (Beadle) on Aug 01, 2004 at 08:32 UTC | |
by pbeckingham (Parson) on Aug 01, 2004 at 15:01 UTC | |
by tadamec (Beadle) on Aug 02, 2004 at 00:59 UTC | |
|
Re: Relative Module Path
by Anneq (Vicar) on Aug 02, 2004 at 01:50 UTC | |
by wfsp (Abbot) on Aug 02, 2004 at 07:22 UTC | |
|
Re: Relative Module Path
by astroboy (Chaplain) on Aug 01, 2004 at 20:46 UTC | |
|
Re: Relative Module Path
by Forsaken (Friar) on Aug 01, 2004 at 19:52 UTC |