The IO::File, IO::Socket::INET modules have some advantages over directly using perl's built-in IO functions, such as having explicit syntax to flush a handle.
However, they seem to have some disadvantages over the built-in IO functions. For example, as far as I can tell they can't be combined with the autodie module to raise exceptions on failure, so I'm finding myself having to write overall more boilerplate code to handle failures than I was with built-in functions.
Is there a way to combine the two, or some other modules that have the combined functionality? I've noticed some limited-purpose IO modules, such as File::Slurp, do allow more flexible error handling.
I'm writing module code, and ideally, the solution should work all the way back to perl 5.10.0.
IO::File
objects anyway (given a sufficiently modern perl, and maybe anuse IO::File
to load the methods) – so you can use the builtins likeopen
without giving up the OOP features. – Prescott