in reply to Re: RFC: How did I do writing my first test?
in thread RFC: How did I do writing my first test?
After all of the talk about final newlines, and a problem just hit me in the head. I did not take into consideration blank lines in files. What if a file has a blank line or two in the middle? If there is a blank line it currently, the before and after still get put on the list without any other value.
test.txt (file)
red orange yellow spring green teal cyan azure blue violet magenta pink white black gray
Code
perl -E ' use lib "mods/lib"; use Fancy::Open qw(fancy_open); my @array=fancy_open("test.txt", { before => "solid ", after => " bead +" }); say $_ for @array; '
Result
solid red bead solid orange bead solid yellow bead solid spring bead solid green bead solid teal bead solid cyan bead solid azure bead solid bead solid blue bead solid violet bead solid magenta bead solid pink bead solid white bead solid black bead solid gray bead
So, I am now three steps back from being ready to package this module. *sighs*
I didn't feel like fighting with splice right now to add an empty line in the test script.
My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.
No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: RFC: How did I do writing my first test?
by jcb (Parson) on Sep 27, 2020 at 02:33 UTC | |
by stevieb (Canon) on Sep 28, 2020 at 01:51 UTC | |
Re^3: RFC: How did I do writing my first test?
by Arunbear (Prior) on Sep 26, 2020 at 18:06 UTC |
In Section
Seekers of Perl Wisdom