This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change Storable's code.t to serialise a subroutine under our control.
authorNicholas Clark <nick@ccl4.org>
Sat, 10 Sep 2011 19:18:00 +0000 (21:18 +0200)
committerNicholas Clark <nick@ccl4.org>
Wed, 14 Sep 2011 09:49:38 +0000 (11:49 +0200)
commit89fa4092e9eb4b2c39ef338275abc7f5949befd1
tree01146ba1ea9ec732b48343e1bcdff3845f3625fd
parent6797988b273c1f95c01750967b12cf4be188cdbf
Change Storable's code.t to serialise a subroutine under our control.

The test originally testing serialising and deserialising \&Test::ok. When
the test was converted from Test.pm to Test::More in 2009, it was changed to
use \&Test::More::ok. However, this turns out to be "works on my machine".
Test::More::ok from Test::Simple 0.61 onwards (2005, b1ddf16980125497) will
deserialise correctly. The previous implementation of Test::More::ok uses a
lexical from an outer scope. Hence the textual representation of the
subroutine (in isolation) fails to deserialise, because it's not valid under
strict, because there is no visible declaration of the lexical.

Hence switch to testing a large subroutine under our control, _store(), to
avoid unpleasant surprises from dependencies we were not even aware of.

The comment "large scalar" dates from the original test using \&Test::ok.
It's not clear which large scalar it refers to.
dist/Storable/t/code.t