briandfoy/test-file — Issue #3: Request for feature: file_contains_ok
Author: barefootcoder
Created: 2011-12-31 01:42:27+00:00
State: open

Okay, here's the next thing I need. Something like this:

file_contains_ok($myfile, qw/^\d{8}:/m, 'file has a datestamped line in the expected format');

IOW, it slurps in the file contents and checks it against the supplied regex. Obviously no good for very large files, but that's okay in my particular use case. Since I'm already in the groove with the other changes, I'd just as soon crank it out now, if you agree it would be a useful change.

Alternate name suggestion: `file_like` ... I think I might like that better, actually. Your call. (Or, another thought: `file_contents_like`. Whichever one you think is best.)

Does this sound good?