Skip Menu |

This queue is for tickets about the Expect CPAN distribution.

Report information
The Basics
Id: 15878
Status: resolved
Priority: 0/
Queue: Expect

People
Owner: Nobody in particular
Requestors: andykirk [...] ubermonkey.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 1.17



Subject: Cannot unset coderef in log_file
Using Expect-1.15 on Perl 5.6.1, Debian GNU/Linux 3.0, I found that I can log to a coderef as described in the Expect API docs, but I cannot unset this reference and stop logging by calling $exp->log_file(undef). The simplest workaround for this case is to call $exp->log_file(sub{return}); I am pretty sure the bug lies in Expect.pm and is not due to my Perl or OS version. The log_file method of Expect would only set the exp_Log_File attribute to undef if it were already set and not a coderef. I have included a patch against Expect.pm to fix this case, its the result of running diff against the old and new versions of the file, sorry if its not in the format expected.
338,339c338,341 < if (${*$self}{exp_Log_File} and ref(${*$self}{exp_Log_File}) ne 'CODE') { < close(${*$self}{exp_Log_File}); --- > if (${*$self}{exp_Log_File}) { > if (ref(${*$self}{exp_Log_File}) ne 'CODE') { > close(${*$self}{exp_Log_File}); > }