diff options
author | Graham Barr <gbarr@pobox.com> | 2000-10-06 11:22:05 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-10-06 11:40:41 +0000 |
commit | 2ecf2f18702e39bbc9823245e3f601c8a14c24f6 (patch) | |
tree | 3568d5d833b0bd51be8f62ce4f1ec8115f836e3d /ext | |
parent | 5b154c98be56f978a407aaee4189e852999c14ea (diff) | |
download | perl-2ecf2f18702e39bbc9823245e3f601c8a14c24f6.tar.gz |
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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/IO/lib/IO/Handle.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm index 9d84206b5c..b6cb410b57 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<perlvar> 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 { |