Skip to content

Request for feature: file_contains_ok #3

barefootcoder opened this Issue Dec 31, 2011 · 7 comments

2 participants


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?


If you're really motivated, I can just make you a comaintainer of the module.

Well, I'm really motivated right now, at least. ;-> Actually, $work is just firing up a rearchitecture project that I'll be on for the next year at least, and much of it will be done using TDD, so I will probably be motivated for at least that long. I'm currently co-maintainer of Method::Signatures with schwern, so I have a bit of experience.

What's your PAUSE ID?


@barefootcoder barefootcoder added a commit to barefootcoder/test-file that referenced this issue Jan 2, 2012
@barefootcoder barefootcoder first cut at file_contains_like
this addresses GitHub issue #3
code and tests; added to test_manifest and MANIFEST
added POD
still need to allow multiple tests on the contents
also should add file_contains_unlike
@barefootcoder barefootcoder added a commit to barefootcoder/test-file that referenced this issue Jan 3, 2012
@barefootcoder barefootcoder implemented file_contains_unlike (for GitHub #3) a3f00b4
@barefootcoder barefootcoder added a commit to barefootcoder/test-file that referenced this issue Jan 3, 2012
@barefootcoder barefootcoder file_contains_(un)?like now accept multiple patterns
for GitHub #3
if PATTERN is an arrayref, will test multiple patterns against the file contents
saves having to read the file contents over and over
updated tests and POD, natch

There, implementation done. Should be on the pull request (#2).


You are now a co-maintainer, so you can release new versions.

I'd like to be more help, but I'm just doing too many things right now. So, I'll just give you the keys to the car. :)

Not a problem. I'll drive carefully, I promise. :) Is there anything you want to tell me about how she drives before I take off? By which I mean, shal I just start releasing as I see fit, or do you want to do a quick approval before a release? any other special instructions so I make sure to leave the car in as good a shape (or hopefully better) than I found her in?

Also, I presume you don't want me to release from my fork (as that would put the upstream repo out of date), so you may want to make me a collaborator here. :)


You are now a collaborator.


I typically release as a dev release, see that everything works, fix things, and release a stable version when it's all fixed.

Yep, that's how I do it as well. Thank <insert deity of choice> for CPAN Testers!

I don't need to do a quick approval. We don't have to be perfect because it's easy to fix anything we mess up. You're probably going to make mistakes, but then we all do. Just go for it.

Sounds good. I'll get a dev release out before the end of the week.

I don't want to get in the way of progress, and I'm feeling a bit overloaded at the moment so I'm reducing my to-do list and trying not to block people. :)

Hey, they way I look at it, you've done a great deal for Perl, and for me personally. I use Test::Output all the time, it seems like every other question I look up on Google has an answer from you on Stack Overflow, and I was just poking around in the new edition of Effective Perl not two days ago. I'm happy to give back what little I can as a way of saying "thanks for all you do." :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.