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

This has not been my week... another module related problem.

My ISP is missing many key modules and has outdated versions of others. So, I decide to create my own collection of modules under my own directory. Seems simple enough. I read the man pages, I re-read the explanantion in Effective Perl Programming (Hall & Schwartz). No problem.

I download DBI 1.14 to /usr/home/sz/myperl.
I unzip/untar the file.
I run Makefile.PL LIB=/usr/home/sz/myperl.
I run make and make test.
Everything looks good.

I then write bit of code to use DBI 1.14 just to see if it will compile. Being a good little monk-in-training I even remember to put use lib='usr/home/sz/myperl' before the "use DBI 1.14" statement.

Result: perl complains that it only has version 0.93, which is what the ISP has installed.

I've tried extending the lib pragma to /usr/home/sz/myperl/DBI-1.14/lib but this did not help.

Please put me out of my misery. I've reread everything manpage and perl book I have for clues.

sz sits quietly mumbling "learning is fun... learning is fun..."

Replies are listed 'Best First'.
Re: lib pragma and module installation
by gnat (Beadle) on Sep 02, 2000 at 04:31 UTC
    PREFIX is when you're built your own complete installation of Perl and installed it there. LIB is probably what the questioner wants.

    You have the steps incomplete, though:

    mkdir ~/src cd ~/src (download DBI-1.blahblah.tar.gz) tar xzf DBI-1.blahblah.tar.gz cd DBI-1.blahblahblah perl Makefile.PL LIB=~/myperl make make test make install
    I'm keeping the source code to the DBI module in one place (~/src) and the installed version in another (~/myperl). Always a good idea.

    Then put this at the top of your program that uses the DBI module:

    use lib "/usr/home/sz/myperl"; use DBI;
    and it should load the DBI library from that directory.

    If you have different versions of Perl all over the place, you might have to say:

    /pkg/perl5/plus/bin/perl Makefile.PL LIB=~/myperl
    To specify which version of Perl the module is being built for. This would be the same version of Perl that you put at the top of your programs:
    #!/pkg/perl5plus/bin/perl -w
    Hope this helps you!

    Nat

Re: lib pragma and module installation
by chromatic (Archbishop) on Sep 02, 2000 at 04:07 UTC
    perlfaq8 suggests a slightly different syntax when installing:
    When you build modules, use the PREFIX option when generating Makefile +s: perl Makefile.PL PREFIX=/u/mydir/perl
    You also mention a use DBI 1.14; statement. I've personally never had to specify a version number. You might try the following to see what your library path is: print "@lib\n";

    Update: I checked gnat's book, and Recipe 12.17 agrees with what he's said. perlfaq8 distributed with 5.005_3 is, in my opinion, a little misleading. Sorry about that!

Re: lib pragma and module installation
by sz (Friar) on Sep 06, 2000 at 15:48 UTC
    To answer my own question, at least partially:

    It seems that using perl Makefile.PL with the PREFIX parameter rather than LIB solved my problem. In the process of installing a number of modules in my local directory yesterday I noticed that the choice of LIB or PREFIX makes a difference, although I fail to see a pattern.

    Any thoughts?

    Best,

    sz
Re: lib pragma and module installation
by sz (Friar) on Sep 02, 2000 at 06:55 UTC
    Dear Nat and Chromatic,

    Thanks so much for the help. When I go the extra step and "make install" I get a "permission denied" error as make tries to act on the ISP's central perl installation. Is there a parameter I can pass to get it to point to my own perl directory?

    I also forgot to include the problem that got me working on installing the latest DBI in the first place. I need to install DBD:CSV, which requires version 1 or later of DBI. When I get DBI installed, how can I get the dependency check to pass. It seems that the Makefile.PL checks the ISP's DBI version rather than my local directory.

    Again, thanks so much for all your help.

    Sergej