Skip Menu |

This queue is for tickets about the IO-stringy CPAN distribution.

Report information
The Basics
Id: 127843
Status: new
Priority: 0/
Queue: IO-stringy

People
Owner: Nobody in particular
Requestors: PAWELKROL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.111
Fixed in: (no value)



Subject: Stringification crashes on a closed IO::Scalar handle
Hi! I would like to be able to stringify any IO::Scalar handle (regardless if it was previously closed or not). However when an IO::Scalar handle is closed, stringification will *always* crash a program. Here is a minimal code that demonstrates the bug and the results of its execution: $ cat ./test.pl #!/usr/bin/perl use IO::Scalar; $var = new IO::Scalar; $var->close; print "$var"; $ ./test.pl Can't use an undefined value as a SCALAR reference at /usr/local/share/perl5/IO/Scalar.pm line 157. $ echo $? 255 I confirmed it to crash in the latest version of IO::Scalar (2.111) package. It could be fixed easily for example by replacing an overloaded '""' method with the following code (line 157 of "IO/Scalar.pm" file): use overload '""' => sub { $_[0]->opened ? ${$_[0]->sref} : 'undef' }; I would very much appreciate if this problem could be addressed in the next version of this excellent package. Many thanks! Best regards, Pawel Krol.