nysus has asked for the wisdom of the Perl Monks concerning the following question:

When I run a script using WWW::Mechanize::Firefox I get the following output to the console:

I, MOZREPL : Client connected : 127.0.0.1:50859 : chrome://browser/con +tent/browser.xul ... I, MOZREPL : Client closed connection : 127.0.0.1:50859

I'm trying to figure out how to turn these off. I tried setting log => ['fatal'] when creating the W:M:F object but it had no effect.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: How to turn off MozRepl messages when using WWW::Mechanize::Firefox
by Marshall (Canon) on Apr 27, 2016 at 12:23 UTC
    This question has been around for awhile with no takers. A few thoughts that might help, emphasis on "might".

    I've fiddled with Mozrepl before, but its been a long time ago. I don't know of anyway to tell it not to do what it wants to do with STDOUT.

    You can of course re-direct STDOUT from your script to the "bit bucket". On Unix, I think this is dev/null. On Windows there is a reserved file name, NUL that serves the same purpose. program.pl > NUL sends output of program.pl to nowhere.

    It is possible to make a detached process without a command line window. On Windows, see detached Tk process. This is a technique to get Tk started without the annoying command line window. If the window isn't there, then of course users won't see any messages printed to it. I think you could launch your program without a command window.

    Again, I don't know of any way to interfere with MozRepl's use of STDOUT. Both ideas above just have to do with throwing away what is written to STDOUT.