Subject: | "validate" crashes on a closed IO::Scalar object |
Hi!
I would like to use Params::Validate's "validate" function to validate an IO::Scalar object. However when an IO::Scalar object is closed, "validate" will *always* crash regardless of whatever actual validation callbacks are defined.
Here is a minimal code that demonstrates the bug and the results of its execution:
$ cat test.pl
#!/usr/bin/perl
use Data::Dumper;
use IO::Scalar;
use Params::Validate qw(:all);
sub test {
print Dumper \@_;
validate(@_, { arg => {} });
}
my $var = new IO::Scalar;
$var->close;
test({ arg => $var });
$ ./test.pl
$VAR1 = [
{
'arg' => bless( \*IO::Scalar::FH, 'IO::Scalar' )
}
];
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 at least since version 1.23. I have got the latest version of IO::Scalar (2.111) installed as well.
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.