artist has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellow monks.
I have few scripts and packages in single directory which I like to move in another directory except the main program ( main.pl). What would be the easy solution? The other programs also contains the require statements, file opening ( without specifiying full paths ) etc.

Thanks,

Seeking art of moving
Artist

Replies are listed 'Best First'.
Re: Moving around directories
by ides (Deacon) on Sep 03, 2002 at 21:49 UTC

    Well I would move them into the place, and tweak your code to fit the new path structure. There really isn't some secret magic way to do this.

    The most correct solution however would be to make all the 'requires' into real modules that can be installed like CPAN modules with perl Makefile.PL. Then you can move main.pl anywhere you like and it doesn't matter.

    -----------------------------------
    Frank Wiles <frank@wiles.org>
    http://frank.wiles.org
Re: Moving around directories
by sauoq (Abbot) on Sep 04, 2002 at 01:19 UTC

    If this is a set of things that is supposed to work together, it often makes sense to keep the scripts together in a single "bin" directory and the modules or packages or library files in a "lib" directory. You can add use lib '/my/lib/dir' to your scripts to specify the lib directory. You might take a look at FindBin for some ideas on how to make this technique more flexible by using paths relative to the script.

    -sauoq
    "My two cents aren't worth a dime.";