use strict;
use warnings;
use feature qw/ say /;
use Scalar::Util qw/ blessed/;
open my $fh, ">", undef;
say blessed( *$fh{ IO }); # IO::File
say *$fh{ IO }-> can( "print" ) ? "yes" : "no"; # no
autoflush $fh 1;
say *$fh{ IO }-> can( "print" ) ? "yes" : "no"; # yes
And:
use strict;
use warnings;
use Log::Log4perl qw / :easy /;
use Log::Dispatch::Handle;
open my $fh, ">", undef;
#autoflush $fh 1;
my $app = Log::Log4perl::Appender-> new(
"Log::Dispatch::Handle",
handle => *$fh{ IO });
__END__
The IO::File class is missing the 'print' method
And uncommenting the comment makes the program run OK and error message gone.