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)
- Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
- Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
-
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
-
Please read these before you post! —
-
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
-
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
- Link using PerlMonks shortcuts! What shortcuts can I use for linking?
-
See Writeup Formatting Tips and other pages linked from there for more info.