2

The new Mac Mini Server comes with OS X 10.6 and natively supports (comes with) two versions of Perl and Apple has included these by default for good reason.

These can be found under the following directories: /Library/Perl/5.8.9 and /Library/Perl/5.10.0 I also found under /Library/Perl/Updates/5.8.9 and /Library/Perl/Updates/5.10.0.

I found that I can successfully switch between perl 5.8.9 and and 5.10.0 at the console level by using Apples suggested "defaults write" command using the terminal.

For example since OS X Server 10.6 comes delivered with the default set to 5.10.0 I have successfully used the following two commands to switch to perl 5.8.9 using 32 bit and everything works as expected at the console level.

sudo defaults write /Library/Preferences/com.apple.versioner.perl Version 5.8.9
sudo defaults write com.apple.versioner.perl Prefer-32-Bit -bool yes

I was successful at installing the following desired Perl modules using the CPAN shell like so for the default version of perl 5.10.0:

sudo perl -eshell -MCPAN
install DBI
install CGI
install HTML::Template
install DBD::Pg

I used DBD:Pg to connect to the PostgreSQL database and that seems to work fine too.

However, when I attempt to switch to Perl 5.8.9 from 5.10.0 I get the following Error in Apache when attempting to use the same Perl Code.

Server error!
  The server encountered an internal error and was unable to complete your request.
  Error message:
  Premature end of script headers: login.pl
  If you think this is a server error, please contact the webmaster.
Error 500
  192.168.2.100
  Mon Aug 9 12:10:09 2010
  APACHE/2.2.14(UNIX)mod_ssl/2.2.14 OpenSSL/0.9.81

I then decided that it might be a good idea go through the "sudo perl -eshell -MCPAN" stuff again after I switched to perl 5.8.9 by using the "default write" command however that didn't seem to help.

Does anyone have any ideas why I am getting these results? Do you have any suggestions on a better approach without using precompiled binaries as I don't have any problem compiling from source code.

Thanks in advance.

DougPan

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Dougpan
  • 87
  • 4
  • "Apple has included these by default for good reason." --> not really. They really should remove 5.10.0 and ship with 5.10.1 -- 5.10.0 has various issues that mean it should be abandoned for good. It is generally suggested to leave your system perls alone, and install new versions separately, where you can install CPAN modules at will, and generally leave the system installations alone. Please see [this excellent guide](http://stackoverflow.com/questions/398221/how-do-you-manage-perl-modules-when-using-a-package-manager/398397#398397). – Ether Aug 09 '10 at 19:02

1 Answers1

0

Tried App::perlbrew and local::lib? The first is designed for managing multiple installations of perl (though don't know if it can do existing ones) the second is for having ... more special cases of libraries installed. It would make it very easy to have 1 set of cpan libraries for each perl version and each app if you needed.

xenoterracide
  • 16,274
  • 24
  • 118
  • 243
  • Thanks for your reply to this however I am already able to switch between versions without any problem at all except when I use Apache mods. – Dougpan Aug 13 '10 at 20:07