Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Installing modules to a private module directory

by tinita (Parson)
on Apr 21, 2008 at 20:42 UTC ( #682027=note: print w/replies, xml ) Need Help??


in reply to Installing modules to a private module directory

do you have an example where
perl Makefile.PL PREFIX=/dir LIB=/dir
does not work? i didn't find one in your blog.

Replies are listed 'Best First'.
Re^2: Installing modules to a private module directory (cases)
by tye (Sage) on Apr 22, 2008 at 01:01 UTC

    It was quite recently reported again that Module::Build still hates PREFIX= (despite it having been quite a while since the last time I heard rumor of somebody going to teach its author how to handle PREFIX= in a reasonable way). Perhaps the report is due to an old version of the module being used, but I suspect not. (And, yes, "perl Makefile.PL" 'should' work even if Module::Build was used, that is, so long as you don't specify PREFIX=.)

    Of course, I don't have to strain at all to imagine cases where "cp -pr ..." would fail.

    - tye        

      I guess you refer to my report. The version of Module::Build was as you suspect recent:
      perl -MModule::Build -e 'print "$Module::Build::VERSION \n";' 0.2808

      It was no big deal doing a perl Build.pl --install_base ~/perl5lib, other than having to resolve a couple of dependencies the same way before succeding. I'd really like to get that .modulebuildrc configured correctly to avoid the hassle.

      Now, I'm not sure if I find it a relief or terifying that issues like these even annoys people like Dominus, who are not a just litle bit smarter and more knowlegdable than I am.

      It will be interesting to see if the method he describes on his blog works for me. If it does, it can't be to hard to make a nice litle script for it.

        I was going to note that it would be trivial to replace the less-portable "cp -pr" with a tiny Perl script but then I was disappointed when my 20 seconds spent searching for the details of how to do that with "core" Perl modules didn't actually turn up a solution. I jumped to File::Path then quickly realized I meant to look at File::Copy but then I didn't find a "copy directory tree" function in either (but, at only 20 seconds, I certainly could have missed it).

        So this node is my taunt to the community to point out where this functionality already is (hopefully in "core") or to goad somebody into implementing it (hopefully as a patch to a "core" module).

        Although I suspect that there are modules that are not perfectly served by the "cp -pr" approach, such modules are likely the tiny minority (modules that have done the hard work of figuring out how to goad things like ExtUtils::MakeMaker into installing unusual items such as executable scripts or config files or something). Given that even the shiny new features of the new1 Module::Build are still reported to have similar problems to the ones Dominus rightly complains about (insertion of annoying subdirectories) and perhaps worse (only sometimes inserting those subdirectories), this "better solution" seems worth "implementing".

        1 No, the ommission of the "shiny" adjective was not accidental. q-:

        - tye        

Re^2: Installing modules to a private module directory
by Dominus (Parson) on Apr 22, 2008 at 05:10 UTC
    i didn't find one in your blog.
    Did you actually try this? I did, and it fails, for reasons I did explain in the blog. ("...the first thing everyone says is that you can just set PREFIX to X. No, because...")

      Instead of PREFIX, you can use INSTALL_BASE, which I believe is now the perferred option for Module::Build and ExtUtils::MakeMaker (so long as you have up-to-date versions of both). I haven't had a problem with this, altho I haven't installed all of CPAN with it.

      You still run into the problem of setting your @INC, since things seem to randomly install in a subdirectory called either 'site_perl', 'perl5' or '5.x.x', meaning you have to add 3 entries to your @INC. This can be annoying if your paths can change depending on the box you're working on.

      Did you actually try this?
      otherwise i wouldn't ask.
      maybe i just don't get it, but it has always worked for me to install my modules with setting PREFIX and LIB. i just asked for an example. show me a module where it doesn't work. that's all i asked for. i would be really interested because i use the PREFIX/LIB method for my cgipan script and i would like to correct it if it has got a mistake.
      in your blog you gave the reason why it doesn't work to set PREFIX. but you didn't say that using PREFIX and LIB together fails.

        You might try DBI. That seems to be at least one example case, based on the context given in his blog.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://682027]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2021-12-02 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (27 votes). Check out past polls.

    Notices?