in reply to How do i Unit Test a subroutine
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).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do i Unit Test a subroutine
by ejvar (Initiate) on Jan 23, 2015 at 11:40 UTC | |
by Laurent_R (Canon) on Jan 23, 2015 at 22:07 UTC |