X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFileHandle.pm;h=6be2242944044d2ca8fb08bbd001d46b0f899034;hb=3376de987afecc3e3aea14b3dea087f4b50fd3f4;hp=0264b61f15d3c1e8c6dc5b3cc71f7ab531d8b21c;hpb=8490252049bf42d3d2f75d89178a8682bf22ba74;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/FileHandle.pm b/lib/FileHandle.pm index 0264b61..6be2242 100644 --- a/lib/FileHandle.pm +++ b/lib/FileHandle.pm @@ -1,10 +1,10 @@ package FileHandle; -use 5.003_11; +use 5.006; use strict; -use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); +our($VERSION, @ISA, @EXPORT, @EXPORT_OK); -$VERSION = "2.00"; +$VERSION = "2.01"; require IO::File; @ISA = qw(IO::File); @@ -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); }; } @@ -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; } @@ -224,7 +225,7 @@ supported C methods: Furthermore, for doing normal I/O you might need these: -=over +=over 4 =item $fh->print @@ -237,17 +238,21 @@ See L. =item $fh->getline This works like <$fh> described in L -except that it's more readable and can be safely called in an -array context but still returns just one line. +except that it's more readable and can be safely called in a +list context but still returns just one line. =item $fh->getlines -This works like <$fh> when called in an array context to +This works like <$fh> when called in a list context to read all the remaining lines in a file, except that it's more readable. 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,