Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: Can Test::MockObject mock a file?

by Lady_Aleena (Curate)
on Sep 21, 2020 at 20:06 UTC ( #11122030=note: print w/replies, xml ) Need Help??


in reply to Re^3: Can Test::MockObject mock a file?
in thread Can Test::MockObject mock a file?

I am sorry I am having a hard time figuring out why I would want to put the file generation into a function. Each "file" generated is different, and they do not take up that many lines in the test. Not much is being duplicated as far as I can see.

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
  • Comment on Re^4: Can Test::MockObject mock a file?

Replies are listed 'Best First'.
Re^5: Can Test::MockObject mock a file?
by chromatic (Archbishop) on Sep 21, 2020 at 20:23 UTC
    Not much is being duplicated as far as I can see.

    Not a huge amount, no, but when you start putting encoding there, you may find that modifying all the places you generate these files is more work than modifying it in one place.

    Each "file" generated is different

    Sure, but creating the filehandle, writing it out, closing it, checking for errors, all of that is the same.

    Like I said, I wouldn't worry about it until your test file gets much larger. It's just a matter of taste at this point.

      ... modifying all the places you generate these files is more work than modifying it in one place.

      Lady_Aleena: Remember: DRY!


      Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11122030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2020-11-24 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?