If you're asking about testing in general, then see Test::More. Just one recent simple example of many to be found online (many CPAN modules have test suites) is here (although in your case I assume you'd be importing the sub in from a module instead of defining it in the test file itself).
If your question is how to test this specific sub, then it'd be better if you could show the actual code, since this is obviously not it. If you're asking how to test the code with a "fake" database, then perhaps one of the modules Test::MockDBI or DBD::Mock could help (disclaimer: I haven't used them but I've seen them recommended).
In reply to Re: How do i Unit Test a subroutine
by Anonymous Monk
in thread How do i Unit Test a subroutine
by ejvar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |