Is it possible to find out what IO Layer a Perl filehandle has on it?
For example:
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Unable to open '$filename': $!";
say io_layer($fh); # prints "encoding(UTF-8)"
The following returns the names of the PerlIO layers on a filehandle.
my @layers = PerlIO::get_layers($fh); # Or FH, *FH, "FH".
more details in PerlIO doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With