Install Perl Locally -- If this works for Catalyst, it'll work for anything!
tphyahoo
created: 2006-09-01 10:27:40
First, some background.

I had a lot of trouble installing a Catalyst/DBIC development environment. I have left various crumbs of angst (* check the wiki history :) ) around the monastery and the catalyst wiki, begging for help on how to do this and not really getting a satisfactory answer.

To be fair, the base catalyst install alone was clean -- I think there's been a lot of work getting this into a state where it can be easily installed from CPAN recently. But cpen -i Catalyst won't get you far. To get the most leverage, you need DBIC, and various DBIC helpers, and various Catalyst helpers. These tend to be on the bleeding edge of CPAN, and to have dependencies that are even more bleeding edge than they are.

These won't install without the occasional force, as root.

And as non-root, I had constant cronic problems involving warnings telling me this was not doable without sudo, that directory wasn't writable... and this even after hours of experimentation with variations on the suggestions in nodes such as

[id://12444],

and catalyst propaganda such as

Catalyst on Shared Hosting (advent calendar)

The usual advice is to configure some combination of PERL5LIB/PREFIX/LIBS/UNINST/choose your poison, and when the magic env vars are set, everything will "just work". This is probably true for simple installs that don't have a lot of dependencies. But it's not true at the bleeding edge of CPAN. At the bleeding edge of CPAN, install don't "just work" as advertised.

Why not? I haven't really tracked down the root cause, but for a small whiff of what I suspect is a very big pile of stink, have a look at [id://564720] and then the c.p.l.m thread mentioned by [tinita]. Over my head but in any case... uh oh.

Passing on, when I finally got all my goodies installed (as root), I had this nagging worry that I wouldn't be able to reliably recreate the my development environment without a lot of manual trial and error. Of course I could just tar up my perl install, but that didn't feel clean.

With all this drama, I was slowly started to get the feeling I would have to become a CPAN ninja to feel safe using catalyst, and that this was not a good thing.

Well, in this case, it seems that light at the end of tunnel was not a train. Or, if it was a train, it still hasn't run me over :)

The solution -- the right solution, the one that feels clean to me -- was to install a local version of perl, configure my environment to use that in an intuitive way, and then maintain a perl script for the cpan install, that installs everything in the right order. The install script is under active development, constantly being tweaked, and the tweaks are being tracked in version control.

This feels right.

Works for root, works for non root. And as root, the nice thing is that if my perl gets borked for some reason, or I just need to start over, it's easy. Delete perl, recompile perl locally, and run the install script.

Finally, here is my recipe for installing perl locally on a freshly installed Debian. FWIW, this was for Debian 3.01 on my virgin tektonic VPS.

as root:

(
apt-get -y update
apt-get -y upgrade
apt-get -y install libc6-dev
apt-get -y install gcc
apt-get -y install emacs21
apt-get -y install subversion
apt-get -y install postgresql
)

then, adduser thartman

then, as thartman:

( wget http://search.cpan.org/CPAN/authors/id/N/NW/NWCLARK/perl-5.8.8.tar.gz tar -xzvf perl-5.8.8.tar.gz cd perl-5.8.8 sh Configure -Dprefix=/home/thartman/perlroot/perl -des #make this your home directory make test make install mkdir -p ~/usr/local #used for template toolkit installation ) | tee perlinstall.out ( cat >> ~/.bashrc export $PATH=~/home/thartman/perlroot/perl/bin:$PATH export FTP_PASSIVE=1 ) cpan, manual configuration? no o conf prerequisites_policy follow o conf commit install cpan (i.e., upgrade CPAN)

Now, obviously the apt-get lines still require root, but I still think this is a huge improvement. And maybe there's some way to apt-get as a non-root, I don't know, I'm still learning my way around debian.

But at any rate, this is the constellation that has brought me peace of mind with catalyst and, I suspect, moving forward, peace of mind with a variety of non-plain-vanilla perl contexts.

Hope this helps!

Note: I was partly inspired to write this when I came across Catalyst: Compile your own perl in your home directory and don't worry about it.

Also of interest might be my bookmarks at perl clean install UPDATE: Matt trout has recently updated the shared hosting with dreamhost bit of the catalyst wiki, and said that he done this enough times that he is convinced it works.

I haven't tried the updated instructions yet.

UPDATE 2: Just in case it helps someone, here is my "constantly under development script, install-my-catalyst-mods.pl. This is nothing special; it just uses cpan through perl to get things installed in the correct order and minimize complaining about missing dependencies.

My guiding principle is, given a virgin debian server (eg a VPS box I could buy without hassle and for pennies a day), configure perl + cata environment in under an hour. This is harder than it sounds, but doable.

#!/home/thartman/perlroot/perl/bin/perl
use strict;
use warnings;
use CPAN;

# Htmlwidget:
# test for Net::DNS::Resolver::Recurse fails on tektonic VPS
# same as reported in http://www.nntp.perl.org/group/perl.cpan.testers/341522
# but we go ahead and use this module anyway
force('install', 'Net::DNS');
install('HTML::Widget');

#goto Digestcolumns;
for my $mod qw(
  Catalyst::Plugin::ConfigLoader
  Catalyst::Plugin::Session::State::Cookie
  Catalyst::Plugin::Static::Simple
  Catalyst::Plugin::StackTrace
  Catalyst::Plugin::Authentication
  Catalyst::Plugin::Authentication::Store::DBIC
  Catalyst::Plugin::Authentication::Credential::Password
  Catalyst::Plugin::Authorization::Roles
  Catalyst::Plugin::Authorization::ACL
  Catalyst::Plugin::Session
  Catalyst::Plugin::Session::Store::FastMmap
  HTML::Widget
  Catalyst::Plugin::HTML::Widget
  Catalyst::View::TT
  Algorithm::C3
  Class::C3
  DBIx::Class
  Catalyst::Model::DBIC::Schema
  Lingua::EN::Inflect::Number
  Catalyst::Action::RenderView
  DBD::Pg
) {
    if ( my $result = install ($mod) ) {
      die "couldn't instal: $mod, result: $result";
    }
    #print "result: $result";
    #die;#die "couldn't install: $mod";
}

Digestcolumns:
#install ('XML::XPath');
install ('IO::Scalar');
install ('Text::RecordParser');
install ('SQL::Translator');
force ( 'install', 'DBIx::Class::DigestColumns');
die;

Cpanplus:
install ('Bundle::CPANPLUS::Dependencies');
install ('Module::Loaded');
install ('Package::Constants');
install ('Test::Harness');
install ('CPANPLUS');

# Module::Signature causes headache, see list posts.
system('rm -f /usr/lib/perl5/site_perl/5.8.8/Module/Signature.pm');
die;
Re: Install Perl Locally -- If this works for Catalyst, it'll work for anything!
created: 2006-09-01 10:31:16

My guess is that all modules using Module::Build didn't properly install, as older versions of Module::Build don't respect PREFIX. But installing Perl locally has been a longstanding practice and I recommend it over using the system-installed Perl in any situation, because it gives you more control and sanity.

Re: Install Perl Locally -- If this works for Catalyst, it'll work for anything!
created: 2006-09-01 10:55:02
An automated local install of modules using PREFIX and LIB and the Module::Build equivalents works perfectly for Krang. It builds all of the bundled module dist packages with a script and adding new ones is as simple as dropping them in the src/ directory and running the build script.
Re: Install Perl Locally -- If this works for Catalyst, it'll work for anything!
created: 2006-09-01 12:15:50

See also Schwern's Why PREFIX Will Never Work, which may help point to install_path for CPAN://Module::Build.

perlmonks.org content © perlmonks.org and chromatic, Corion, perrin, tphyahoo

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03