in reply to Re^2: getting data to a signal handler
in thread getting data to a signal handler
In general, lexical closures are a handy and useful technique, but I'm not entirely sure what interesting edge cases will emerge if you combine them with signal handlers. I wouldn't care to speculate on that without understanding the nittier and grittier details of how signal handlers are handled.
What I would do is name the global in a fashion that prevents it from ever having a namespace collision and then just leave it global. For instance, I might call it something like $SIGINT_HANDLER_GLOBAL_ONE_FOR_NET_SERVER_POP3 (if it were the first global variable for the interrupt signal handler for Net::Server::POP3; as it happens that module doesn't have any such thing, but you get the idea).
|
|---|