因为shell操作mongo比较麻烦,只好尝试使用perl操作mongo,perl需要操作mongodb必须先安装相应的驱动,大部分人使用cpan安装,个人觉得太麻烦,使用cpanm安装perl模块。
cpanm报错了,使用–force参数
看起来一切完好。测试脚本
脚本内容:
运行:
google查询“mongodb.so: undefined symbol: heutf8”,只发现一篇相关文章.一群人讨论这个问题。其中一个人的解决方法如下:
perl脚本运行ok.
实际上是因为不兼容的问题,对于系统rhel5/centos5发行版,mongodb的perl驱动最后的一个版本是v0.45
如下是国外网友的回复:
the latest version to compile, test and install properly on rhel5/centos5 is v0.45 by kristina. (requires any::moose)
https://metacpan.org/release/kristina/mongodb-0.45