in reply to RFC: How did I do writing my first test?
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:
perldoc My::Module
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: RFC: How did I do writing my first test?
by Lady_Aleena (Priest) on Sep 24, 2020 at 16:28 UTC | |
by Arunbear (Prior) on Sep 25, 2020 at 13:12 UTC | |
Re^2: RFC: How did I do writing my first test?
by jcb (Parson) on Sep 24, 2020 at 22:30 UTC | |
by Arunbear (Prior) on Sep 25, 2020 at 13:17 UTC | |
by jcb (Parson) on Sep 25, 2020 at 22:48 UTC | |
Re^2: RFC: How did I do writing my first test?
by Lady_Aleena (Priest) on Sep 26, 2020 at 01:59 UTC | |
by jcb (Parson) on Sep 27, 2020 at 02:33 UTC | |
by stevieb (Canon) on Sep 28, 2020 at 01:51 UTC | |
by Arunbear (Prior) on Sep 26, 2020 at 18:06 UTC |