http://www.perlmonks.org?node_id=826948

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

Hi,

does anybody know if there's a way to suppress windows errors in ActivePerl. After hours and hours running my script always encounters an error regarding the msvcrt.dll, version 7.0.3790.3959

This is quite annoying since the script is running as a service and therefore it mustn't throw an error in a window.

Even though I'm able to fix this error, there's still a chance to encounter another problem which would be thrown in front of the gui. So I need anything like a global try catch for my script, I guess.

Or am I missing any point?

Daniel

Replies are listed 'Best First'.
Re: suppress windows error
by RMGir (Prior) on Mar 05, 2010 at 12:18 UTC
    What does the error popup say?

    If it's giving you a chance to debug the application, you can suppress it with _CrtSetReportMode (in C - I doubt the Win32 module supports that).

    You can get more info at the doc page.

    Perhaps you can use Inline::C to call

    _CrtSetReportMode(_CRT_ASSERT, 0); _CrtSetReportMode(_CRT_ERROR, 0); _CrtSetReportMode(_CRT_WARN, 0);
    Note that this just changes where the warnings go to - if an assertion failed, your process is still going to die, but at least it can be restarted right away without needing a human to click a button...

    Mike
Re: suppress windows error
by roboticus (Chancellor) on Mar 05, 2010 at 12:18 UTC

    posti:

    You can use eval to catch errors in your code. So you may have to wrap the guts of your script in an eval block so you can catch and recognize the error(s). Then take the appropriate action (e.g. restart) for the error.

    If you mentioned the specific error, you may have even received some help regarding that problem...

    ...roboticus

Re: suppress windows error
by posti (Novice) on Mar 05, 2010 at 12:42 UTC
    Well the error is in german, but I'll try to translate ;)

    faulting application perl.exe, version 5.8.8.817,
    faulting module msvcrt.dll, version 7.0.3790.3959,
    fault address 0x00037f20.

    This happens while running SpamAssassin's spamd. I'd be great if I could suppress this due an option in ActivePerl while not touching the original spamd code so I don't need to edit it every time a new version comes out.
      I think the easiest part of that to fix is "5.8.8.817". Why not try a more current version of perl?

      Core dump bugs (and this is the windows version of a core dump) do get rarer and rarer in newer versions of perl. And the release announcement says that 5.8.8 is 4 years old - that's a lot of time for bug fixes.


      Mike
        The reason I use 5.8.8 is, there are several modules which do not function properly with 5.10. But I'll give it a try again since these modules are optional, if it solves the problem with these errors it is worth it.