[Catalyst] CatInABox on NearlyFreeSpeech.net

Gary Ashton-Jones gary at ashton-jones.com.au
Mon Feb 13 02:30:58 CET 2006


There is a comment on the wiki about not being able to install Perl 
modules using CPAN. It's true if you just use their default 
environment.

However yesterday I wanted to try out a simple Cat app I'm developing 
for a friend and CatInABox seemed the quickest way to get running. 
First I downloaded the CAIB tarball into /home/private, unzipped and 
ran startup.sh. This left me a basic Cat environment. I ran catalyst.pl 
MyApp, and copied script/myapp_cgi.pl to /home/htdocs/myapp.cgi. Then I 
put these lines in /home/htdocs/.htaccess:

SetEnvIf  Request_URI  ".cgi" PERL5LIB=/home/private/CatInABox/extlib
RewriteEngine on
RewriteRule .* myapp.cgi [L]

I also added this line to myapp.cgi:

use lib "/home/private/CatInABox/MyApp/lib";

and it works nicely.

Then I realised the implication of the PERL5LIB setting so I tried perl 
-MCPAN -e shell and got an error about not being able to open /dev/tty. 
Bugger! However a quick check of Term::ReadLine doco unearthed an 
alternative way of opening ReadLine which doesn't stall on unreadable 
/dev/tty. I needed to edit CPAN.pm. Well I was already in my own 
environment thanks to CAIB. All I had to do was install my own CPAN.pm 
and edit it. So I downloaded CPAN.pm tarball from CPAN, unzipped it and 
typed:

perl Makefile.PL PREFIX=/home/private/CatInABox 
LIB=/home/private/CatInABox/extlib
make
make install

Et voilá, instant editable CPAN.pm.

On line 95 of CPAN.pm I changed:

$term = Term::ReadLine->new('CPAN Monitor');

to

$term = Term::ReadLine->new('CPAN Monitor', *STDIN, *STDOUT);

then typed:
cpan

and got an error about an uneditable Config file which was in fact the 
NFS one. I looked in extlib/CPAN and there wasn't a Config.pm (because 
it never got created because there is already one in NFS's system 
directory, etc.).

So I copied CPAN/Config.pm from my laptop into CAIB/extlib. I didn't 
care what it's settings were as long as it is editable by me.

Then I typed 'cpan' and then typed 'o conf init' and accepted most of 
the default options but changed:
'makepl_arg' => q[PREFIX=/home/private/CatInABox 
LIB=/home/private/CatInABox/extlib],
'mbuildpl_arg' => q[--install_path lib=/home/private/CatInABox/extlib],

And now I have my own copy of cpan which installs into CAIB/extlib so I 
immediately installed the Seamtress modules because I don't want to use 
TT. Works a treat!

Cheers

Gary



-------------- next part --------------
A non-text attachment was scrubbed...
Name: Config.pm
Type: application/octet-stream
Size: 1911 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060213/4b6f13bc/Config.obj
-------------- next part --------------





More information about the Catalyst mailing list