From: Nicholas Clark Date: Sat, 10 Sep 2011 19:18:00 +0000 (+0200) Subject: Change Storable's code.t to serialise a subroutine under our control. X-Git-Tag: accepted/trunk/20130322.191538~2774^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89fa4092e9eb4b2c39ef338275abc7f5949befd1;p=platform%2Fupstream%2Fperl.git 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. --- diff --git a/dist/Storable/t/code.t b/dist/Storable/t/code.t index 687a6d1..c383142 100644 --- a/dist/Storable/t/code.t +++ b/dist/Storable/t/code.t @@ -60,7 +60,7 @@ local *FOO; \&Another::Package::foo, # code in another package sub ($$;$) { 0 }, # prototypes sub { print "test\n" }, - \&Test::More::ok, # large scalar + \&Storable::_store, # large scalar ], {"a" => sub { "srt" }, "b" => \&code},