OS: Mac 10.12.1, mysql 5.7.15
perl -e 'print $];'
Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at ./testDBConnection.pl line 8.
BEGIN failed--compilation aborted at ./testDBConnection.pl line 8.
#use lib '/usr/bin/cpan';
Database was generated on Fri, 18 Nov 2016 19:41:02 GMT
DBD::mysql is up to date (4.039).
perldoc -lm DBI DBD::mysql
Your shebang line refers to
/usr/bin/perl. That is the interpreter that will be used to execute your script.
/usr/bin/perl is the
perl that comes with your system. You did the right thing by not messing with the modules that came with it and instead installing your own. Now, you should tell your script to use it.
It looks like the correct
perl is already in your path. Use
which perl to see the full path to it.
As a side note, there is really no reason for the
DBI will chose which driver to load based on your connection string.
Make links to per-version tools by brian d foy may help. I personally find tools such as
perlbrew to be more a hindrance than help.