[Bioperl-l] SeqIO fixing: detecting if a filehandle is open for
writing
Hilmar Lapp
hlapp at gmx.net
Thu Aug 5 13:24:44 EDT 2004
On Thursday, August 5, 2004, at 03:13 PM, Peter van Heusden wrote:
> The Perl behaviour is slightly different (not that I think anyone
> checks these things): if you do 'print $fh "FOO\n"' and $fh is open
> for reading only, the return value of print is undef (otherwise it is
> 1).
>
> There might not be anything do-able about this case, but as far as
> possible I think that reasonable programmer errors should be caught.
Well if that's the case since $seqio->write_seq() doesn't need to
return anything really other than an indicator for success or failure
why don't we do exactly that. I.e., why don't you fix
$seqio->write_seq() to return success or failure as much as perl itself
does it.
In fact, if the first, or any for that matter, print statement in SeqIO
fails according to the return value from perl, one could argue that
another print attempt does not need to be made or is even harmful if it
succeeds b/c partial but seemingly complete output would be the result.
-hilmar
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------
More information about the Bioperl-l
mailing list