Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'm not convinced that testing of a final new line adds any value, especially given that your code looks agnostic to its presence/absence (from both the code writer and code users point of view). Putting the tests in subroutines (one for each group of tests) would make the code more skimmable, and save you from needing to use arcane names like ($n_fh, $n_file) i.e. having that in a sub means they would only exist in one place and can have more 'normal' names like in the encoding test case. As for the code itself, 'fancy_open' is not an accurate name because it is doing reading and closing as well as opening. In Perl parlance, this is called "slurping", so I'd suggest "fancy_slurp". Slurping into an array is fine for small files, but will become inefficient as the input files get larger, so you may want to consider providing an iterator as well. Why keep the POD in a separate file? POD is designed to be embeddable in the module and e.g. to veiw it you could just do:
In reply to Re: RFC: How did I do writing my first test?
by Arunbear
|
|