X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFileHandle.pm;h=eec9b61f31bbd296d85b9d4c8bf72b8d4a76bff5;hb=4499d6b9d14594604210bc28005c5e4ab2e49947;hp=1dc699c85be811339b2063996e21bcad97334046;hpb=c9de509e331450a10058399280ce28f68f0faf39;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/FileHandle.pm b/lib/FileHandle.pm index 1dc699c..eec9b61 100644 --- a/lib/FileHandle.pm +++ b/lib/FileHandle.pm @@ -69,7 +69,8 @@ import IO::Handle grep { !defined(&$_) } @EXPORT, @EXPORT_OK; sub import { my $pkg = shift; my $callpkg = caller; - Exporter::export $pkg, $callpkg, @_; + require Exporter; + Exporter::export($pkg, $callpkg, @_); # # If the Fcntl extension is available, @@ -77,7 +78,7 @@ sub import { # eval { require Fcntl; - Exporter::export 'Fcntl', $callpkg; + Exporter::export('Fcntl', $callpkg); }; } @@ -94,9 +95,9 @@ sub pipe { } # Rebless standard file handles -bless *STDIN{IO}, "FileHandle"; -bless *STDOUT{IO}, "FileHandle"; -bless *STDERR{IO}, "FileHandle"; +bless *STDIN{IO}, "FileHandle" if ref *STDIN{IO} eq "IO::Handle"; +bless *STDOUT{IO}, "FileHandle" if ref *STDOUT{IO} eq "IO::Handle"; +bless *STDERR{IO}, "FileHandle" if ref *STDERR{IO} eq "IO::Handle"; 1; @@ -111,7 +112,7 @@ FileHandle - supply object methods for filehandles use FileHandle; $fh = new FileHandle; - if ($fh->open "< file") { + if ($fh->open("< file")) { print <$fh>; $fh->close; } @@ -248,6 +249,10 @@ It will also croak() if accidentally called in a scalar context. =back +There are many other functions available since FileHandle is descended +from IO::File, IO::Seekable, and IO::Handle. Please see those +respective pages for documentation on more functions. + =head1 SEE ALSO The B extension,