Subject: | Regular filehandle not recognized as a "seekable" filehandle |
Background at https://stackoverflow.com/questions/45827030
Term::ProgressBar::IO does not recognize a regular filehandle. In the `Term::ProgressBar::IO::init` function, a regular filehandle will often not pass the test
ref($count) && $count->can('seek')
Success can depend on the version of perl, whether the `IO::File` module has been loaded, and whether the filehandle has previously made a method call. The fix suggested on the stackoverflow question will only work for recent perls (5.24 or better, maybe 5.22).
A more robust check that will work for perl >=5.12 is something like
ref($count) && eval { $count->seek(0,SEEK_CUR);1 }
For perl 5.10 or older, the object oriented calls don't seem to work at all and you may want to resort to a different implementation of the `init`, `__determine_max`, and `__determine_count` methods to handle that case.