Just another Perl shrine | |
PerlMonks |
Re: Sharing data between tests?by Util (Priest) |
on Jan 31, 2012 at 21:31 UTC ( [id://951075]=note: print w/replies, xml ) | Need Help?? |
Unless efficiency is truly critical, I would avoid Storable, along with any other binary format. Test suites (both code and data) are a form of documentation, and should be in a human-readable format. Even when the datasets are generated during one test, and (normally) deleted later toward the end of the test suite, a human-readable (and editable) datastore will save you much frustration when diagnosing a failed test. I have used Data::Dumper, YAML, and Config::Tiny on different projects. I think that Config::Tiny is better suited to true config files that a non-programmer will be editing. If I was saving shared test data today, JSON::XS would be my first choice. Note that you need not just bundle the data. You can also bundle helper subroutines, that might simply return the data, or might *generate* the data in some expanded format that your tests can easily use, rather than whatever compact format the data might actually live in.
In Section
Seekers of Perl Wisdom
|
|