It makes absolute sense to use it in a module. I'd also suggest changing the name, of the subroutine slightly, though. Perhaps call it handle_db_error. then you can have other routines such as handle_io_error, or somesuch.
Now read chapter 11 of the Bible. There are too many options to really specify how to do this in a single post. Are you going OO, for example? Do you want to have the routine available in all scripts, or should it be imported explicitly?
In reply to Re: Changing a subroutine to a module
by weedom
in thread Changing a subroutine to a module
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |