diff options
author | Gisle Aas <gisle@aas.no> | 2000-09-04 00:04:22 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-09-07 18:35:37 +0000 |
commit | 052b629eb0274721d73944a03d3c4aac89392a61 (patch) | |
tree | 03ea3481bea496667e31bb1fee9b889de6dfe408 /lib/Tie/Handle.pm | |
parent | b2a2e44b450818f2f7253c8bae310ef6d04df564 (diff) | |
download | perl-052b629eb0274721d73944a03d3c4aac89392a61.tar.gz |
Tie::StdHandle did not know about 3-arg open
Message-ID: <20000904000422.26002.qmail@eik.g.aas.no>
p4raw-id: //depot/perl@7022
Diffstat (limited to 'lib/Tie/Handle.pm')
-rw-r--r-- | lib/Tie/Handle.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Tie/Handle.pm b/lib/Tie/Handle.pm index 42d0834ed8..86adad2098 100644 --- a/lib/Tie/Handle.pm +++ b/lib/Tie/Handle.pm @@ -183,10 +183,10 @@ sub WRITE { sub CLOSE { my $pkg = ref $_[0]; croak "$pkg doesn't define a CLOSE method"; -} +} package Tie::StdHandle; -our @ISA = 'Tie::Handle'; +our @ISA = 'Tie::Handle'; use Carp; sub TIEHANDLE @@ -196,7 +196,7 @@ sub TIEHANDLE bless $fh,$class; $fh->OPEN(@_) if (@_); return $fh; -} +} sub EOF { eof($_[0]) } sub TELL { tell($_[0]) } @@ -206,9 +206,9 @@ sub CLOSE { close($_[0]) } sub BINMODE { binmode($_[0]) } sub OPEN -{ +{ $_[0]->CLOSE if defined($_[0]->FILENO); - open($_[0],$_[1]); + @_ == 2 ? open($_[0], $_[1]) : open($_[0], $_[1], $_[2]); } sub READ { read($_[0],$_[1],$_[2]) } @@ -216,7 +216,7 @@ sub READLINE { my $fh = $_[0]; <$fh> } sub GETC { getc($_[0]) } sub WRITE -{ +{ my $fh = $_[0]; print $fh substr($_[1],0,$_[2]) } |