PerlIO::Layers allows you to query the filehandle's properties.
