I see random complains like below when I instantiate a WWW::Mechanize::Chrome object:
Log4perl: Seems like no initialization happened. Forgot to call init() +? 23:28:21 Sent 'Target.closeTarget' message $VAR1 = '{"id":11,"params": +{"targetId":"F75959D2137237798CF1FCB89E87FFAA"},"method":"Target.clos +eTarget"}'; 23:28:21 Can't call method "irand" on an undefined value at (eval 140) + line 17 during global destruction.
As an example, consider the following test-script. For me, the below script sometimes passes and sometimes it fails (see below for when exactly), although all subtests succeed all the time.
#!/usr/bin/env perl use Test::More; use WWW::Mechanize::Chrome; use Log::Log4perl qw(:easy); # This is for the mech obj, Set priority of root logger to ERROR Log::Log4perl->easy_init($ERROR); my %default_mech_params = ( headless => 1, # log => $mylogger, launch_arg => [ '--window-size=600x800', '--password-store=basic', # do not ask me for stupid chrome ac +count password # '--remote-debugging-port=9223', # '--enable-logging', # see also log above '--disable-gpu', '--no-sandbox', '--ignore-certificate-errors', '--disable-background-networking', '--disable-client-side-phishing-detection', '--disable-component-update', '--disable-hang-monitor', '--disable-save-password-bubble', '--disable-default-apps', '--disable-infobars', '--disable-popup-blocking', ], ); my $mech_obj = WWW::Mechanize::Chrome->new(%default_mech_params); ok(defined($mech_obj), "WWW::Mechanize::Chrome->new() : called.") or B +AIL_OUT("failed to create WWW::Mechanize::Chrome object"); done_testing();
Here is what it says when I run make all && make test. Note that this fails all the time.
Manifying 1 pod document PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::H +arness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/l +ib', 'blib/arch')" t/*.t t/xx.t .. 1/? Log4perl: Seems like no initialization happened. Forgot +to call init()? 2025/08/11 23:40:43 Sent 'Target.closeTarget' message $VAR1 = '{"metho +d":"Target.closeTarget","id":11,"params":{"targetId":"FF3672A330F5788 +556F1B4B18CCC5610"}}'; 2025/08/11 23:40:43 Can't call method "irand" on an undefined value at + (eval 140) line 17 during global destruction. t/xx.t .. Dubious, test returned 255 (wstat 65280, 0xff00) All 1 subtests passed Test Summary Report ------------------- t/xx.t (Wstat: 65280 (exited 255) Tests: 1 Failed: 0) Non-zero exit status: 255 Files=1, Tests=1, 11 wallclock secs ( 0.03 usr 0.00 sys + 0.41 cusr + 0.12 csys = 0.56 CPU) Result: FAIL Failed 1/1 test programs. 0/1 subtests failed. make: *** [Makefile:873: test_dynamic] Error 255
However, when I run make all && perl -Iblib/lib t/xx.t, sometimes it fails with above complaining and sometimes it succeeds.
I use the latest W:M:C v0.73. It fails with perl v5.40.2. On another computer with perl v5.38.2 I see no failures (after 10 consecutive runs). Both running latest linux.
Thanks, bw, bliako
ps. my question is not urgent, don't stop swimming to answer it...
ps2. OT but Corion does the dreadful Log4* abomination Log::Log4perl need to be used by WWW::Mechanize::Chrome?
In reply to WWW::Mechanize::Chrome : random complaining that Log4perl is not initialised and test fails by bliako
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |