为什么 WWW::Mechanize::Firefox 无法找到它的“新”地址?方法?
当我运行小示例脚本时,出现以下错误:
Can't located object method "new" via package "WWW::Mechanize::Firefox" (perhaps 你忘了在 mechtest.pl 第 2 行加载“WWW::Mechanize::Firefox”?)。
use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new();
$mech->get('http://google.com');
$mech->eval_in_page('alert("Hello Firefox")');
my $png = $mech->content_as_png();
我安装了 WWW::Mechanize::Firefox,我在 Firefox 上安装了 MozRepl 插件。为什么找不到新的呢?
I get the following error when I run the little sample script:
Can't locate object method "new" via package "WWW::Mechanize::Firefox" (perhaps
you forgot to load "WWW::Mechanize::Firefox"?) at mechtest.pl line 2.
use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new();
$mech->get('http://google.com');
$mech->eval_in_page('alert("Hello Firefox")');
my $png = $mech->content_as_png();
I have WWW::Mechanize::Firefox installed, I have the MozRepl plugin installed on Firefox. Why can't it find new?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您很可能使用的是 Windows,并且安装了旧版本的 WWW::Mechanize::Firefox。那个旧版本当时被(糟糕地)命名为Fire_F_ox(注意大写的F)。查看您的计算机上是否有 FireFox.pm 文件。
Windows 具有不区分大小写的文件系统,因此即使您请求加载文件 Firefox.pm,它也会愉快地加载文件 FireFox.pm。
解决方案是卸载 WWW::Mechanize::FireFox 并安装 WWW::Mechanize::Firefox。另外,如果您告诉我们 Perl 的版本、模块的版本以及您使用的操作系统,对于将来的报告会有很大帮助。
-最大限度
Most likely you are on Windows and have an old version of WWW::Mechanize::Firefox installed. That old version was at the time (badly) named Fire_F_ox (note the upper case F). Look whether you have a file FireFox.pm on your machine.
Windows has case-insensitive filesystems and hence will happily load a file FireFox.pm even if you request to load a file Firefox.pm.
The solution is to uninstall WWW::Mechanize::FireFox and to install WWW::Mechanize::Firefox. Also, for future reports, it immensively helps if you tell us the version of Perl, the version(s) of the module(s) and the OS you use.
-max
听起来 WWW::Mechanize::Firefox 没有正确安装。重新启动并确认其安装正确(cpan、ppm 等)。
Sounds like WWW::Mechanize::Firefox isn't installed properly. Reboot and confirm that it's installed properly (cpan, ppm etc).
该模块需要一些依赖项,例如
MozRepl::RemoteObject
等。您可能应该使用 cpan 或 ppm (如果使用 ActiveState)等重新安装
The module requires some dependencies like
MozRepl::RemoteObject
etc.you should probably reinstall using cpan or ppm (if using ActiveState) etc