Subject: | Undefined subroutines not reported when parameter is call to Safe::Hole wrapper |
Date: | Thu, 31 Aug 2017 16:57:51 +0000 |
To: | "bug-Safe-Hole [...] rt.cpan.org" <bug-Safe-Hole [...] rt.cpan.org> |
From: | Gavin Matthews <gmatthews [...] ntent.com> |
Hello. I'm trying to use the Safe module<https://perldoc.perl.org/Safe.html>.
The problem I'm having is that, if the code calls an undefined subroutine, no error is reported if one of the parameters is a call to a Safe::Hole<http://search.cpan.org/~seyn/Safe-Hole-0.10/Hole.pm> wrapper that returns a wrapped object.
Here is a simplified example:
perl -we 'use Safe; use Safe::Hole; printf("%s, %s\n", $Safe::VERSION, $Safe::Hole::VERSION); use JSON; my $safe = Safe->new; my $hole = new Safe::Hole {}; sub w() { print "In wrapped w() subroutine.\n"; return $hole->wrap(JSON->new); } $hole->wrap(\&w, $safe, "&w"); print "This should fail:\n"; $safe->reval("sub x { return \&w; } f(x());"); print "It succeeded\n" unless($@);'
2.35, 0.10
This should fail:
In wrapped w() subroutine.
Use of uninitialized value $typechar in string eq at /usr/lib64/perl5/vendor_perl/Safe/Hole.pm line 121.
It succeeded
This seems like a bug in either Safe::Hole or Safe itself. Any suggestions? Thanks!