http://qs321.pair.com?node_id=681763

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

I've been struggling to not mess up my linux (Ubuntu 7.10) installation like I've previously used to do. Now, with a rather fresh install of Ubuntu (and updates), I wanted to avoid having issues with aptitude and cpan running in each others way.

So, I've set PERL5LIB to ~/perl5lib and cpan seems happy to run without sudo. Somehow I've got a helping of ~/share with ~/share/perl/5.8.8 and a lot of the modules I've installed or upgraded with cpan seems to go there, but well, it seems ok.

Now, I wanted to install SQL::Translator, but the install bails out complaining:

Sorry, PREFIX is not supported. See the Module::Build documentation for 'destdir' or 'install_base' instead.

Well, I added a ~/.modulebuildrc file with sole content:

install --install_path /home/kai/perl5lib
but the same "Sorry, PREFIX ..." results.

I need some suggestions here now, or some better (super|google)search-terms than I've managed to come up with myself.

Also, I've tried to set --install_path to the same as PERL5LIB, is that wise? silly? enough?

Update:
Thanks for all the good sugestions. They will probably help, but I'm not entirely there yet, so more suggestions are still welcome.

Update 2:
I've got SQL::Translator installed using

look SQL::Translator perl Build.PL --install_base /home/kai/perl5lib ./Build test ./Build install
although I had to work my way backwards through a couple of dependencies that also barked the same way.
I'd really like to have .modulebuildrc correctly set up and working.
Now to new searches...
Update 3:
The version I'm using:
perl -MModule::Build -e 'print "$Module::Build::VERSION \n";' 0.2808

Replies are listed 'Best First'.
Re: What to tell Module::Build, and where?
by dragonchild (Archbishop) on Apr 20, 2008 at 14:44 UTC
    Avoid the whole mess and keep two perl installs. Have the system perl (/usr/bin/perl or /usr/local/bin/perl) which aptitude maintains. Then, have your own personal perl (~/bin/perl) which has your own modules. Check out Perl::Install for an easy way to install it. Patches welcome.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

      I agree, though usually keep my own perl in either ~/opt, or else maybe /opt. This way, you can keep all of it under the same tree (which makes an uninstall very easy (i.e. rm -fr ~/opt/perl-5.10.0), if that's ever necessary).

      I've never used Perl::Install. I just read the build instructions that come with Perl and go to it.

        I would normally agree, but I found myself having to install Perl over and over as part of a deployment process. So, I threw this together as a first-pass CPAN-ization of my scripts.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      Nice idea! I made an extra account with low privileges and tried, but the installation of Perl::Install wants to write to /usr/local/bin and so stopped there. I'll try again with some broader permissions, but I think it should do that operation on something like ~/local/bin?
        As I said, patches are most welcome. This is the first CPAN distro I made that has installable scripts in it, so I probably screwed up somewhere. The scripts run on their own, so you could just download them from cpan.org and go from there.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: What to tell Module::Build, and where?
by oko1 (Deacon) on Apr 20, 2008 at 14:45 UTC

    I'm running pretty much the same setup as you, and in all the years of using CPAN and 'apt-get', they've never "interfered" with each other. I will admit that I was initially apprehensive about it as well.

    With regard to your .modulebuildrc - I don't know if this is sufficient to fix your problem, but that's not how 'install_path' works; it actually takes 2 arguments, the section to install and a location to install that section (e.g., "install_path lib /home/ken/lib/perl5".) Perhaps you meant '--install_base' - which does take a single argument.

    
    -- 
    Human history becomes more and more a race between education and catastrophe. -- HG Wells
    
      in all the years of using CPAN and 'apt-get', they've never "interfered" with each other
      Well, there might be something to all those years, and you might be better than me to actually rtfm...

      I tried to set .modulebuildrc once with install_path lib /home/kai/perl5lib and once with install_base /home/kai/perl5lib but Module::Build still wasn't impressed.

      I've read the perldoc on Module::Build, but it's a litle vague on the actual syntax of the .modulebuildrc, so I've tried all the combinations both with and without leading whitespace, but without any noticeable effect.

Re: What to tell Module::Build, and where?
by sundialsvc4 (Abbot) on Apr 20, 2008 at 17:58 UTC

    Many folks deal with an analog of this same problem with regard to “shared-hosting plans” for websites. You're running as a non-root guest, in a shared environment along with hundreds or even thousands of other sites, and this environment is being updated from time-to-time (you hope...) by the ISP vendor. Meanwhile, the site-specific environment used by your website must be maintained. In addition, you want to keep mirrors of each site's environment on your own development machine:   even when the several sites that you're responsible for are completely different, you want to be able to manage them all with an easy rsync.

    You'll find a wealth of existing information here if you search for keywords like “shared hosting” and “PERL5LIB,” and you should do that next. I think it will be much more helpful than anything I could repeat here.

    I maintain each website that I maintain, from a separate login account on my own systems. Each one's bash-login script issues the export commands that the site's own Apache configurations will use. (Each site also has a local VirtualHost configuration as blahblah.dev and this is listed in /etc/hosts, but I digress.)

    Anyhow, Perl offers a number of ways to configure the library search-order:   the hard-coded list in the Perl executable; site-wide configuration files; environment variables, and use lib. All of these prepend entries to the @INC list which is always searched front-to-back. Using any one of these methods or some combination, you can set up very specific environments. As you now see, it's a common thing to do. No, the error-messages are not the greatest, but you're certainly not the first person to be head-whacking about them.

    Finally, one other footnote-observation:   I don't know if your distro's management software is written in Perl, but that too is a valid consideration. You probably don't want to touch the “global, system-wide” settings. You don't want to install your CPAN-stuff in the global location. All that you want to do is to be sure that when “you” run “your stuff,” always “your library settings” are the ones that Perl will pick up in “your” case.

Re: What to tell Module::Build, and where?
by FunkyMonk (Chancellor) on Apr 20, 2008 at 22:08 UTC
    Debian (that Ubuntu is derived from) has a package called dh-make-perl that will download (using CPAN), make, test and build a .deb automatically

    Can you get that from apt-get? (If not, can you use the Debian package?)

    Disclaimer: I'm a user of Debian, not Ubuntu

      I've barely noticed it earlier, and I think it just got a few bugfixes in Oslo? I'll look into the docs on that, and come back with a summary. Seems promising!
Re: What to tell Module::Build, and where?
by wrinkles (Pilgrim) on Apr 20, 2008 at 18:01 UTC
    So did you try
    ./Build install --install_base /path_to_base_directory
      No. I want to get it to work properly, and not rather infrequently have to look Into::Module to do a ./Build install, or should I?
Re: What to tell Module::Build, and where?
by perrin (Chancellor) on Apr 21, 2008 at 12:21 UTC
    What version of Module::Build do you have? I think you need to upgrade it to get one that emulates PREFIX. What you're doing now will probably work on what you have if you stop passing PREFIX to it. I'm guessing you have CPAN set to always pass it.
      I have 0.2808, wich is the latest.

      I'll try and find out how to have cpan not pass it.

        A grep of 0.2808 doesn't show the error message you're getting. I think you either don't have 0.2808 or don't have it in the path for the Perl you're running CPAN on.