Term::Readline patch for AmigaOS
[p5sagit/p5-mst-13.2.git] / lib / FileHandle.pm
index e2ce83d..0b5d9ed 100644 (file)
@@ -44,15 +44,22 @@ import IO::Handle grep { !defined(&$_) } @EXPORT, @EXPORT_OK;
 #
 {
     no strict 'refs';
-    for my $f (qw(DESTROY new_from_fd fdopen close fileno getc ungetc gets eof
-                 setbuf setvbuf _open_mode_string)) {
-       *{$f} = \&{"IO::Handle::$f"} or die "$f missing";
-    }
-    for my $f (qw(seek tell fgetpos fsetpos fflush ferror clearerr)) {
-       *{$f} = \&{"IO::Seekable::$f"} or die "$f missing";
-    }
-    for my $f (qw(new new_tmpfile open)) {
-       *{$f} = \&{"IO::File::$f"} or die "$f missing";
+
+    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;
+       }
     }
 }
 
@@ -123,7 +130,7 @@ FileHandle - supply object methods for filehandles
     }
 
     $pos = $fh->getpos;
-    $fh->setpos $pos;
+    $fh->setpos($pos);
 
     $fh->setvbuf($buffer_var, _IOLBF, 1024);
 
@@ -184,7 +191,7 @@ result!
 See L<perlfunc> for complete descriptions of each of the following
 supported C<FileHandle> methods, which are just front ends for the
 corresponding built-in functions:
-  
+
     close
     fileno
     getc