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)
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

index 687a6d1..c383142 100644 (file)
@@ -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},