You want to have a hands-off installation of a trickier-than-normal
perl module such as MySQL. Here's how you can script the
process.
When it comes time to actually build your MySQL module you need to
do a few things.
- Install DBI
- Download Msql-MySQL module
- Run "perl Makefile.PL" and answer questions
or "perl Makefile.PL --options --options"
- make
- make test
- make install
Fortunately the CPAN install command does most of this
for you. You could actually just start a CPAN shell and
type "install Bundle::Mysql". Wait and answer a few questions.
My issue was the answer a few questions part. I'd like to
go and have coffee to return with a fully built module. :)
Here's how (broken across lines to hopefully make more readable):
perl -MCPAN -e
'install Bundle::DBI;
CPAN::Shell->o("conf","makepl_arg",
"--mysql-install --nomsql-install
--nomsql1-install --noprompt
--mysql-incdir=/opt/include/mysql
--mysql-libdir=/opt/lib/mysql");
install Mysql;' >/opt/src/config/logs/mysql-perlmod
A bit of a narrative:
- perl -MCPAN -e
Starts perl with CPAN module and will execute what's in quotes
- 'install Bundle::DBI;
The first perl statement. Should hopefully install all of the modules that makes DBI go in general.
- CPAN::Shell->o("conf","makepl_arg",
This took a bit of digging. This is the same as typing "o conf makepl_args..." at the cpan shell prompt which
is to specify the arguments that we're gonna call "perl Makefile.PL" with.
- "--mysql-install --nomsql-install
--nomsql1-install --noprompt
--mysql-incdir=/opt/include/mysql
--mysql-libdir=/opt/lib/mysql");
If you were to go to the msql-mysql module source directory and type "perl Makefile.PL" you'd eventually arrive at something like this.
Of course your mileage will vary with the options that I've placed here.
- install Mysql;' >/opt/src/config/logs/mysql-perlmod
Last perl statement that will download, build, test, and install Mysql module. (plus log somewhere so we can see any problems after we've returned from coffee)