X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFileHandle.pm;h=0b5d9edcb44bcd6592c66d69868e38738259353a;hb=f8b3e957194312420089105d39c0b37773519523;hp=b2151475906fc083b7fb1175af6cf4ba4d783165;hpb=36477c247f3c188fb8cc7e276c87b739d3e6ab7c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/FileHandle.pm b/lib/FileHandle.pm index b215147..0b5d9ed 100644 --- a/lib/FileHandle.pm +++ b/lib/FileHandle.pm @@ -1,6 +1,6 @@ package FileHandle; -require 5.003; +use 5.003_11; use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); @@ -39,6 +39,31 @@ require IO::File; import IO::Handle grep { !defined(&$_) } @EXPORT, @EXPORT_OK; # +# Some people call "FileHandle::function", so all the functions +# that were in the old FileHandle class must be imported, too. +# +{ + no strict 'refs'; + + my %import = ( + 'IO::Handle' => + [qw(DESTROY new_from_fd fdopen close fileno getc ungetc gets + eof flush error clearerr setbuf setvbuf _open_mode_string)], + 'IO::Seekable' => + [qw(seek tell getpos setpos)], + 'IO::File' => + [qw(new new_tmpfile open)] + ); + for my $pkg (keys %import) { + for my $func (@{$import{$pkg}}) { + my $c = *{"${pkg}::$func"}{CODE} + or die "${pkg}::$func missing"; + *$func = $c; + } + } +} + +# # Specialized importer for Fcntl magic. # sub import { @@ -105,7 +130,7 @@ FileHandle - supply object methods for filehandles } $pos = $fh->getpos; - $fh->setpos $pos; + $fh->setpos($pos); $fh->setvbuf($buffer_var, _IOLBF, 1024); @@ -166,7 +191,7 @@ result! See L for complete descriptions of each of the following supported C methods, which are just front ends for the corresponding built-in functions: - + close fileno getc