in reply to testing exit in Perl modules
You can remove the BEGIN block if you use use_ok() (not in a BEGIN block) to load the module being tested.
Like adrianh, I'm not sure why you changed exit into die. I usually set it to a closure so I can test the arguments that came in and set the return value.
I also use the subs pragma instead of merely defining the subroutine. That way, if someone's used it without parenthesis, it still works. (I have a memory of an edge case somewhere, but it might be the prototype issue on built-ins.)
|
|---|