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

Folks,

I'd like to use Module::Starter to create the basic files for writing modules and I'd like to use the module sthus created while they're still in development, eg. right from their respective blib/ directories.

Problem is, my application can't find them. I have a new module (not created with Module-Starter) just one up directory away and there's no problem in finding it, but the one in blib/ cannot be found.

Here's what I do:

The directories:

~/Devel/Perl/ModuleDevel/ProjectConfig/ProjectConfig.pm

~/Devel/Perl/ModuleDevel/Some-Utils-Text/blib/lib/Some/Utils/Text.pm

The application:

use lib "$ENV{HOME}/Devel/Perl/ModulesDevel/";

use ProjectConfig;

use Some::Utils::Text;

The ProjectConfig module is found and used all right, but not the other. I tried ExtUtils::testlib; as shown in Perl's documentation, but to no avail.

Is it possible at all to work with a module still under development in a blib/ directory and if so, how ?

UPDATE

There was an error: ProjectConfig.pm was still in the application's directory, so it was always found. I removed it and both modules were not found. Good.

To be able to use them at their own location I now do, in the main app:

use lib "$ENV{HOME}/Devel/Perl/ModulesDevel/ProjectConfig/"; use lib "$ENV{HOME}/Devel/Perl/ModulesDevel/Some-Utils-Text/blib/lib/S +ome/Utils/";

Certainly not the most graceful solution, but it works and I can use Module::Starter.

Replies are listed 'Best First'.
Re: Module-Starter in development
by chromatic (Archbishop) on Mar 20, 2006 at 06:17 UTC

    Does it work if you use blib instead of lib?

    Update: I mean:

    use lib "$ENV{HOME}/Devel/Perl/ModulesDevel/Some-Utils-Text";
      It yields: "Cannot find blib even in..."

      Version is:

      "This is perl, v5.8.6 built for i586-linux-thread-multi"

      Looks like blib is not part of that version. The CPAN returns a whole Perl package (5.8.8) for blib. Maybe I can install a brand new Perl, if that's straightforward to do over a pre-existing one (I only built Perl when building Linux From Scratch systems, not over an existing running version).

Re: Module-Starter in development
by idle (Friar) on Mar 20, 2006 at 07:04 UTC
    Try load it thru eval, to see whats wrong:
    Begin { unless ( eval "use Some::Utils::Text") { warn "couldn't load module from lib $ENV{HOME}/Devel/Perl/M +odulesDevel/ $@" ; } } # © Cookbook.

      If his library path is wrong, how will catching and rethrowing the same exception help?

      Basically, that's the run:

      couldn't load module from lib /home/frodo/Devel/Perl/ModulesDevel/ Can't locate Some/Utils/Text.pm in @INC (@INC contains: /home/frodo/Devel/Perl/ModulesDevel/ /usr/lib/perl5/5.8.6/i586-linux-thread-multi ...

      Please see my update.