[Chicago-talk] Dynamic @INC builder?

Jim Thomason jthomasoniii at yahoo.com
Fri Jan 23 10:54:19 CST 2004

I finally dreamed up how I'd like to implement this,
but before I do any work on it, I figured I'd do a
quick check and see if such a tool already exists
before I go cluttering up CPAN with one.

In short, is there an existing module that will
dynamically populate @INC based upon certain keywords?

This comes up when modules are installed in a local
location (~/modules, for example) in one location on a
development environment, but in a completely different
location on a production environment.

Say, for example, I have my own development modules at
"/Users/jim/Documents/Perl", but when I deploy live
they end up at "/home/thomason/perl/". Most annoying.

Now, this is fixed by tacking on double use libs.

use lib "/Users/jim/Documents/Perl/";
use lib "/home/thomason/";

But that's annoying. It gets worse when you factor in
that I have a few scripts I like to deploy on several
servers, requiring multiple lib calls.

use lib "/Users/jim/Documents/Perl";
use lib "/home/thomason/";
use lib "/home/lm/";
use lib "/home/tmr/";

etc. Major nuisance. And, obviously, if I want to
deploy on another machine, I need to go tack on
another use lib. I know I could just use some tricks
with symbolic links or ~ or whatever, but that ties me
down to specific directory structures, and I don't
care for that.

So I'm leaning towards something config file driven.

So you can replace that all with:

use Lib::Finder qw(mymodules);

And then this theoretical Lib::Finder module can look
at a conf file that would define something like:

mymodules = ("/Users/jim/Documents/Perl",
"/home/thomason", "/home/lm/", "/home/tmr/");

And voila. You're all set. Deploy your scripts with
impunity, and as long as Lib::Finder is installed in a
place perl can fine, it'll automagically find your
other module paths for you.

Naturally, a fully functional module would require a
few more bells and whistles beyond simply this.

But before I run off and make those bells and
whistles, I figured I'd check in with my few

1) Does this already exist?
2) Does it sound useful?
3) How's "Lib::Finder" sound as a name?


Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

More information about the Chicago-talk mailing list