|XP is just a number|
Install Perl Locally -- If this works for Catalyst, it'll work for anything!by tphyahoo (Vicar)
|on Sep 01, 2006 at 14:27 UTC ( #570777=perlmeditation: print w/replies, xml )||Need Help??|
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
A detailed How-To for locally installing modules,
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 What are the "prefix" and "lib" arguments to makefile.pl used for? 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.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.
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
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.
Back to Meditations