0

I have a script and keep all external modules local so I can then package my entire script in a zip and have it work on all machines without having to install all the modules on different machines. I do:

use lib "$Bin/cpan"; 

I am trying to initiate a connection to a mysql database so I need to install DBD, DBI and mysql locally how can I do this? I tried the same way by copying the .pm files and it either gives me

DBD::mysql initialisation failed: Can't locate object method "driver" via package "DBD::mysql" at C:/Perl/lib/DBI.pm line 815.

or

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC
user391986
  • 29,536
  • 39
  • 126
  • 205
  • 2
    Are you also copying the `DBD::mysql` libraries (`DBD/mysql/mysql.so` or `DBD/mysql/mysql.dll`) ? – mob Jan 13 '12 at 00:03

1 Answers1

3

Simply transferring archives will probably not work, especially if you're transferring across operating systems or architectures (aside from simply missing files). I recommend using Carton to automate dependency management. Under the hood it uses local::lib (a brilliant module for dev and deployment in its own right) and cpanm to get the work done.

Josh Y.
  • 876
  • 1
  • 6
  • 6