简体   繁体   中英

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.

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:

(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).

I haven't touched anything from this part of the script (don't need to use the db with those pages), at least willingly. 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.

The messages come as remaining Perl/Javascript objects get destroyed in an unordered way during Perl Global Destruction. If you want to avoid them, destroy your $mech object before quitting your application.

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.

Also note that the preferred forum for questions about WWW::Mechanize::Firefox is http://perlmonks.org :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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