in reply to Re: Lexical filehandles: unblessed but (sometimes) can
in thread Lexical filehandles: unblessed but (sometimes) can
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Lexical filehandles: unblessed but (sometimes) can
by ikegami (Patriarch) on Mar 16, 2018 at 20:18 UTC | |
by vr (Curate) on Mar 17, 2018 at 13:45 UTC |