Installing Perl modules under Mac OS XMac OS X comes with a Perl interpreter already installed, so after installing XAMPP
following the instructions
earlier in this chapter, you’ll have two Perl interpreters on your system
/usr/bin/perl and
/Applications/xampp/xamppfiles/bin/perl. You’ll need to configure the DBI and CGI modules for at least one of these.
Since we use XAMPP for other parts of this book, our instructions will focus on it. You can still configure the system default
Perl interpreter by typing /usr/bin/perl in place of
/Applications/xampp/xamppfiles/bin/perl in our instructions, but we feel that you’ll have fewer difficulties if you work with the XAMPP installation.
For XAMPP, you need to do two things to ensure a hassle-free DBD MySQL driver installation. First, to allow the DBD installation process to test the installation
process using the MySQL server, start XAMPP by typing
sudo /Applications/xampp/xamppfiles/mampp startThen create a symbolic link to the XAMPP MySQL socket file in the default MySQL
socket
file location /tmp/mysql.sock, which is where Perl will expect to find it
ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sockSome versions of XAMPP come with permission settings for the
/Applications/xampp/xamppfiles/lib/perl5 directory that don’t allow
ordinary users to access it, causing modules to appear missing. To ensure that the permissions are correctly set, type
sudo chmod u=rwx,g=rx,o=rx /Applications/xampp/xamppfiles/lib/perl5We discussed permission settings in Restricting access to files and directories at the beginning of this chapter.
You can download and install the DBI module,
the MySQL driver, and the CGI module for the XAMPP Perl installation by typing these commands in turn
sudo /Applications/xampp/xamppfiles/bin/perl -MCPAN -e 'install DBI;'$
sudo /Applications/xampp/xamppfiles/bin/perl -MCPAN -e 'install DBD::mysql;'$
sudo /Applications/xampp/xamppfiles/bin/perl -MCPAN -e 'install CGI;'You maybe prompted for the system root user password. You may also be prompted to configure the download locations with the message:
Are you ready for manual configuration [yes]
Unless you’re very sure of what you’re doing, just type
Share with your friends: