From: Graham Barr Date: Fri, 6 Oct 2000 10:22:05 +0000 (+0100) Subject: IO::Handle->syswrite() did not handle length omission X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ecf2f18702e39bbc9823245e3f601c8a14c24f6;p=p5sagit%2Fp5-mst-13.2.git IO::Handle->syswrite() did not handle length omission like CORE::syswrite() does. Subject: [Fwd] IO::Handle, syswrite and arguments Message-ID: <20001006102205.U6312@pobox.com> The original patch from andrew@ugh.net.au. p4raw-id: //depot/perl@7155 --- diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm index 9d84206..b6cb410 100644 --- a/ext/IO/lib/IO/Handle.pm +++ b/ext/IO/lib/IO/Handle.pm @@ -71,7 +71,7 @@ corresponding built-in functions: $io->printf ( FMT, [ARGS] ) $io->stat $io->sysread ( BUF, LEN, [OFFSET] ) - $io->syswrite ( BUF, LEN, [OFFSET] ) + $io->syswrite ( BUF, [LEN, [OFFSET]] ) $io->truncate ( LEN ) See L for complete descriptions of each of the following @@ -425,8 +425,11 @@ sub write { sub syswrite { @_ >= 2 && @_ <= 4 or croak 'usage: $io->syswrite(BUF [, LEN [, OFFSET]])'; - $_[2] = length($_[1]) unless defined $_[2]; - syswrite($_[0], $_[1], $_[2], $_[3] || 0); + if (defined($_[2])) { + syswrite($_[0], $_[1], $_[2], $_[3] || 0); + } else { + syswrite($_[0], $_[1]); + } } sub stat {