in reply to perl 5.010 Can't locate object method "seek" via package "IO::Handle"
Put use FileHandle; at the top of the module that is producing the errors. Some older perls don't load it automatically.
Example:
$ perl -E 'open $fh, "<a.txt"; $fh->seek(0, 0);' Can't locate object method "seek" via package "IO::Handle" at -e line +1.
$ perl -MFileHandle -E 'open $fh, "<a.txt"; $fh->seek(0, 0);'
Or, depending on the code in question (you don't specify where it is), you could use the seek function instead (no need for FileHandle):
seek $fh, 0, 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl 5.010 Can't locate object method "seek" via package "IO::Handle"
by jandrew (Chaplain) on May 05, 2016 at 21:48 UTC |