Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: how to make close() fail

by BrowserUk (Pope)
on Sep 29, 2012 at 01:17 UTC ( #996316=note: print w/replies, xml ) Need Help??


in reply to how to make close() fail

Seems like a completely unnecessary test to me, but ...

sub TIEHANDLE { bless \$_[1], $_[0] };; sub CLOSE{ 0 };; tie *FH, 'main';; close FH or die 'Aaaaaaaaaaaaarg!';; Aaaaaaaaaaaaarg! at (eval 12) line 1, <STDIN> line 4.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^2: how to make close() fail
by dave_the_m (Prior) on Sep 29, 2012 at 09:22 UTC
    Seems liek a completely unnecessary test to me
    NFS for example does buffered writes "over the wire", so all the writes apparently work, only for the final flush associated with the close() to fail (e.g. due to filesystem full)

    Dave.

      I know close can fail, but that wasn't my point.

      How complicated can a failed-to-close code path be that you can't test it 'by inspection'?

      And if it is complicated enough to warrant it, it probably indicates poor design.

      More likely this is the triumph of a "100% code coverage" mandate over reason.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996316]
help
Chatterbox?
[Corion]: Hmm - HTC Vive reduces its price to EUR 700 (from EUR 900). Now I have to look what graphics cards prices are - maybe a good enough VR rig can be had for EUR 1500 now instead of EUR 2000(+)
[Corion]: Hmm - nVidia GTX 1070 + Vive makes EUR 1130, leaving EUR 370 for CPU+case+cooler+ RAM - not bad
[Corion]: (I'm not a fan of AMD)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2017-08-21 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (319 votes). Check out past polls.

    Notices?