Learning Mysql


Installing the Perl DBI and CGI Modules



Download 4.24 Mb.
View original pdf
Page87/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   83   84   85   86   87   88   89   90   ...   366
Learning MySQL
Installing the Perl DBI and CGI Modules
If you found that you need to install the CGI or DBI module, or the MySQL DBD, then you need to follow the steps outlined in the following sections for each operating system.
Installing Perl modules under Linux
The standard way to install Perl modules is to get Perl to use the CPAN (Comprehensive
Perl Archive Network) module to install new modules from the Internet. Login as the system root user by typing su -
, and then install the DBI module, the DBI MySQL
Database Driver, and the CGI module by running the following commands in turn:
Setting up Perl | 89


# perl -MCPAN -e 'install DBI'
# perl -MCPAN -e 'install DBD::mysql;'
# perl -MCPAN -e 'install CGI;'
If this is the first time you’re installing Perl modules this way, you maybe prompted to answer a few questions. It’s generally safe to answer no to the question:
Are you ready for manual configuration [yes]
and leave it to Perl to figure out how to fetch the required packages. If all goes well,
you should see reassuring status messages as Perl downloads and installs everything.
Perl modules are also available for individual Linux distributions, and you can download and install them manually. For RPM-based systems, you should download and install the perl-DBI package for DBI, the perl-DBD-mysql package for the DBI MySQL
driver, and the perl-CGI package for CGI. For example, on a Red Hat or Fedora system,
type:
# yum update perl-DBI perl-DBD-mysql perl-CGI
For a Mandriva or Mandrake system, type urpmi perl-DBI perl-DBD-mysql perl-CGI
For a Debian-based system, the package names are slightly different apt-get install libdbi-perl libdbd-mysql-perl libcgi-pm-perl
Installing Perl modules under Windows
Windows does not have Perl support by default, so you need to install a Perl interpreter yourself. The XAMPP package you installed earlier in this chapter includes a minimal
Perl setup. However, to include a reasonable set of Perl libraries, including the DBI and
CGI modules and the MySQL DBD, you should also visit the web page http://www
.apachefriends.org/en/xampp.html and download and install the Perl Addons installer.
This will have a filename similar to xampp-perl-addon-5.8.7-2.2.2-installer.exe. Install this in the same directory in which your XAMPP installation is located we assume this is C:\Program Files\xampp.
Many of the MySQL command-line programs in the scripts directory are in fact Perl scripts if you want to use these scripts, you’ll need to associate Perl files with the Perl interpreter. To do this, you tell Windows that all files with the standard Perl extension .pl must be run by the Perl interpreter. Open a command prompt window and type the following two lines:
C:\> ASSOC .pl=PerlScript
C:\> FTYPE PerlScript=C:\Program Files\xampp\perl\bin\perl.exe %1 %*
You can now run Perl scripts by double-clicking on the icon of the script file, or by typing in the name of the script file at the command prompt. You can find other tips for using Perl under Windows in the Perl Win FAQ (http://www.perl.com/doc/FAQs/
nt/perlwin32faq4.html).

Download 4.24 Mb.

Share with your friends:
1   ...   83   84   85   86   87   88   89   90   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page