From a Perl test file, how do I check the contents of a file?

Posted by justintime on Stack Overflow See other posts from Stack Overflow or by justintime
Published on 2010-03-30T06:54:25Z Indexed on 2010/03/30 17:43 UTC
Read the original article Hit count: 439

Filed under:
|

I want to test a script I have written in Perl and specifically check what output it writes to file. I wrote it some time ago and don't want to modify it to the extent of turning it into a module but would like to regression test it before adding some small functional changes.

So far I have

use Test::Command tests => 10;

exit_is_num($cmd, 0);
....

But the command produces some files and I want to check those files are the same as I expect (either equal or match some regexp). Any suggestions

© Stack Overflow or respective owner

Related posts about perl

Related posts about testing