简体   繁体   English

Perl MozRepl清理问题

[英]Perl MozRepl cleanup problem

I'm coding a web crawler and I've been using WWW::Mechanize::Firefox to navigate some pages (for the others I use WWW::Mechanize) which keep loading content after the page loaded and I've never had an issue with that. 我正在编写网络爬虫程序,并且我一直在使用WWW :: Mechanize :: Firefox浏览某些页面(其他页面我使用WWW :: Mechanize),这些页面在页面加载后一直在加载内容,而我从来没有问题。

Yesterday I added DBI and DBD::mysql to the script, adding queries to export data to a database (this works perfectly), but suddenly MozRepl started giving this error: 昨天我在脚本中添加了DBI和DBD :: mysql,添加了查询以将数据导出到数据库(这非常有效),但是突然MozRepl开始出现此错误:

(in cleanup) Can't call method "execute" on an undefined value at /Library/Perl/5.10.0/MozRepl.pm line 372 during global destruction.
(in cleanup) Can't call method "execute" on an undefined value at /Library/Perl/5.10.0/MozRepl.pm line 372 during global destruction.

and terminating the script after 1 cycle (it should run until it gets to the end of a specific text file, which it doesn't). 并在1个周期后终止脚本(脚本应运行到到达特定文本文件的末尾为止,而不会)。

I haven't touched anything from this part of the script (don't need to use the db with those pages), at least willingly. 至少在这一部分中,我没有涉及到脚本的这一部分(不需要在那些页面上使用db)。 I checked with a file compare app and couldn't solve anything. 我检查了一个文件比较应用程序,无法解决任何问题。

Posting the code could be tricky, it's pretty long and I have no idea where the problem may lie. 发布代码可能很棘手,时间很长,我也不知道问题可能出在哪里。

EDIT 编辑

Sometimes it also gives this error instead of the previous one: 有时,它还会给出此错误,而不是前一个错误:

(in cleanup) Can't call method "cmd" on an undefined value at /Library/Perl/5.10.0/MozRepl/Client.pm line 186 during global destruction.

This has nothing to do with DBI or DBD::mysql.The messages are nothing to worry about, but I admit they are unsightly. 这与DBI或DBD :: mysql无关。消息不必担心,但我承认它们难看。

The messages come as remaining Perl/Javascript objects get destroyed in an unordered way during Perl Global Destruction. 这些消息是在Perl全局销毁期间以无序方式销毁剩余的Perl / Javascript对象时发出的。 If you want to avoid them, destroy your $mech object before quitting your application. 如果要避免它们,请在退出应用程序之前销毁$mech对象。

undef $mech;
# end of program

If the $mech object is released before the program gets shut down, the Perl/Javascript bridge can also shut down in an orderly fashion. 如果$mech对象在程序关闭之前被释放,则Perl / Javascript桥也可以有序地关闭。

Also note that the preferred forum for questions about WWW::Mechanize::Firefox is http://perlmonks.org :) 另请注意,有关WWW :: Mechanize :: Firefox的首选论坛是http://perlmonks.org :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM