Skip to content

Bugfix/baseparser get filehandle return

Created by: mkszuba

Description

In BaseParser::get_filehandle(), if the provided name does not point to an existing file perform the same check on the alternative name before attempting to use it.

Use case

Without this additional check, get_filehandle() does not correctly report having been passed the name of a non-existent uncompressed file due to the fact that at least on multi-threaded Perl, if the command zcat exists IO::File->new("zcat foo.gz |") returns a valid file handle even if foo.gz cannot be opened for reading; that will only be detected upon the first attempt to read from such a file handle.

Benefits

Behaviour of get_filehandle() closer to expected.

Possible Drawbacks

Slightly increased I/O overhead for users who do rely on get_filehandle() automatically appending .gz to file names.

Testing

Have you added/modified unit tests to test the changes?

Yes and no - appropriate unit tests do exist but will only be added to the repository as part of the backport of Mim2GeneParser from ensembl-xref.

If so, do the tests pass/fail?

They pass.

Have you run the entire test suite and no regression was detected?

Yes, no regressions detected.

Merge request reports