perl 在脚本中打包 dbd mysql 模块
我有一个脚本并将所有外部模块保留在本地,这样我就可以将整个脚本打包在 zip 中并使其在所有计算机上运行,而无需在不同的计算机上安装所有模块。 我这样做:
use lib "$Bin/cpan";
我正在尝试启动与 mysql 数据库的连接,因此我需要在本地安装 DBD、DBI 和 mysql 我该如何执行此操作?我通过复制 .pm 文件尝试了同样的方法,它要么给我
DBD::mysql initialisation failed: Can't locate object method "driver" via package "DBD::mysql" at C:/Perl/lib/DBI.pm line 815.
要么
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单地传输档案可能行不通,特别是当您跨操作系统或体系结构传输时(除了简单地丢失文件之外)。我建议使用 Carton 来自动化依赖管理。在底层,它使用 local::lib (一个用于开发和部署的出色模块)自己的权利)和 cpanm 来完成工作。
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.