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.

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:

Replies are listed 'Best First'.
Re: Automate CPAN install of Bundle::MySQL
by Anonymous Monk on Oct 23, 2007 at 22:56 UTC
    The problem with this example is that as soon as you call "install", the makepl_args gets erased.