# from nadim khemir
# on Saturday 05 January 2008 03:53:

>        print 'hello' ;
>
>triggers the wrath of InputOutput::RequireCheckedSyscalls with the
>message "Return value of flagged function ignored".
>
>...
>
>There is no chance that P::C could know I'm writting on a system
> handle that would require a static analysis that would take ages. If
> possible at all.

Even if it weren't a system handle, in what situation does print() 
return false?

  1.  Closed handle
  2.  Unopened handle
  3.  Disk full

Unless I've missed one, you don't need to check the return value of 
print.

I will even say it is wrong to do so in most situations.  The exception 
would be unattended long-running processes where lots of print() calls 
will happen before a close().  Yes 'print STDOUT' will fail with $! 
= "No space left on device" when stdout is redirected, but I hardly 
think catching that is worth sprinkling so many 'or die "$!"' 
statements around in your code.[1]

For #3, you need to check the return on close().

For #1 and #2  you need to have 100% coverage with warnings enabled and 
test NoWarnings (and check the return code of open().)

This probably means one of your tests needs to fill a disk (or simulate 
it) to get the open/close checks to 100% coverage.

From my fstab:
  tmpfs  /mnt/1MB  tmpfs noauto,user,size=1M,rw,mode=777 0 0

[1] If anything, at least a print() replacement via some XS code which 
throws errors wouldn't cost you an arm+leg at runtime (plus it saves 
the bleeding eyeballs.)

--Eric
-- 
Entia non sunt multiplicanda praeter necessitatem.
--Occam's Razor
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to