Subject: | Signal handling in Mail::Box |
In the source code of Mail::Box there's the line
$SIG{INT} = $SIG{QUIT} = $SIG{PIPE} = $SIG{TERM} = sub {exit 0};
I feel uneasy about this. I believe that signal handling should be
exclusively in a script/program/app, but not in a module. It's not clear
how the conflicting case of script and module both defining the same
signal handler should be handled.
Consider this:
#!/usr/bin/perl
$SIG{INT} = sub { die "my sig handler" };
require Mail::Box;
while() {}
__END__
Here the user-defined signal handler is overwritten by Mail::Box's
definition. Some kind of action-at-a-distance.
And here:
#!/usr/bin/perl
use Mail::Box;
$SIG{INT} = sub { die "my sig handler" };
while() {}
__END__
Mail::Box's signal handler is overwritten by the user-defined one.
I think it's best to remove the definition at all from Mail::Box.
Regards,
Slaven