in reply to How to make a module aware of where it is installed?

I may not understand the nuances of your question, and I apologize in advance if this is the case. However, I wonder if you've tried placing the modules in an appropriate directory structure under lib/ in your distribution directory. I've done that successfully before.

Replies are listed 'Best First'.
Re: Re: How to make a module aware of where it is installed?
by jaldhar (Vicar) on Dec 04, 2002 at 13:48 UTC

    Yes, the module structure is correct under blib/lib. The problem is the main module itself has to know what blib/lib expands to. For instance under perl 5.8 on Debian GNU/Linux,

    INSTALLPRIVLIB='/usr/share/perl/5.8.0' INSTALLSITELIB='/usr/local/share/perl/5.8.0' INSTALLVENDORLIB='/usr/share/perl5'
    The INSTALLDIRS variable in Makefile.PL determines which one gets used or it defaultes to site. It will translate instances of blib/lib in the Makefile itself but doesn't do that elsewhere without the PM_FILTER.

    What I am doing for now is:

    'PM_FILTER' => 'perl -pe \" if (\"$(INSTALLDIRS)\" eq \"perl\") { s|INST_LIBDIR|$(INSTALLPRIVLIB)|g; } elsif (\"$(INSTALLDIRS)\" eq \"vendor\") { s|INST_LIBDIR|$(INSTALLVENDORLIB)|g; } else { s|INST_LIBDIR|$(INSTALLSITELIB)|g; } \"'
    but there has to be a better solution than this.

    --
    જલધર

      chromatic said "lib" not "blib". Create a "lib" subdirectory at the top of your package and put any extra files to be installed in there with the proper directory structure.

      For example, if you are building your module in /home/tye/Foo-Bar then you could have something like the following files:

      /home/tye/Foo-Bar/MANIFEST /home/tye/Foo-Bar/Makefile.PL /home/tye/Foo-Bar/Bar.pm /home/tye/Foo-Bar/lib/Foo/blurp.pm /home/tye/Foo-Bar/lib/Foo/Bar/Baz.pm
      and "make" would create the following files:
      /home/tye/Foo-Bar/blib/lib/Foo/Bar.pm /home/tye/Foo-Bar/blib/lib/Foo/blurp.pm /home/tye/Foo-Bar/blib/lib/Foo/Bar/Baz.pm
      and "make install" would then put them in the correct final location.

              - tye

        Ah ok I misunderstood. This makes my Makefile.Pl marginally simpler, but still doesn't solve the problem of the module itself knowing where it is installed.

        --
        જલધર