in reply to Testing .pl files in Test::Simple
Actually it doesn't matter which extension a file has. The content matters.
Usually perl modules only contain some functions, classes, methods, whatever, that can be used from a script afterwards. Evaluating such a module doesn't execute code normally.
That's different from common perl scripts, which actually do real work when being evaluated. You can include a script in another script as well (using require or do or whatever), but all the code inside the script will be executed as soon as it's being evaluated. Therefor it's not quite possible to include such a script somewhere else (in a test script, for example) just to be able to use functions that are defined by it.
How to fix that?
Of course there may be more possibilities, but I can't think of a clean solution that does not seperate the code that should be tested from the actual script.
Cheers, Flo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Testing .pl files in Test::Simple
by xdg (Monsignor) on Mar 17, 2006 at 03:24 UTC |