Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Testing failures: How to override print to make it fail?

by adrianh (Chancellor)
on May 05, 2005 at 13:34 UTC ( #454357=note: print w/ replies, xml ) Need Help??


in reply to Re: Testing failures: How to override print to make it fail?
in thread Testing failures: How to override print to make it fail?

What scenario are you envisioning that a print failing will be the sole indicator of a failure state?

You can have a print fail due to, for example, lack of space on the device and then have the close succeed later on.

There's also the argument that it's better to FailFast.

  • Comment on Re^2: Testing failures: How to override print to make it fail?

Replies are listed 'Best First'.
Re^3: Testing failures: How to override print to make it fail?
by dragonchild (Archbishop) on May 05, 2005 at 13:36 UTC
    If you're printing to a filehandle, then use a IO::File-derived class that will encapsulate that die for you, and test that. I'm not quite sure how STDOUT or STDERR runs out of space, though.

    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
      I'm not quite sure how STDOUT or STDERR runs out of space
      $ script.pl orig.txt 2> /var/log/errors.log > new.txt && rm new.txt

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2016-07-30 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (264 votes). Check out past polls.