7 require Config; import Config;
8 keys %Config; # Silence warning
9 if ($Config{extensions} !~ /\bList\/Util\b/) {
10 print "1..0 # Skip: List::Util was not built\n";
16 use Scalar::Util qw(readonly);
17 use Test::More tests => 11;
19 ok( readonly(1), 'number constant');
23 ok( !readonly($var), 'number variable');
24 is( $var, 2, 'no change to number variable');
26 ok( readonly("fred"), 'string constant');
30 ok( !readonly($var), 'string variable');
31 is( $var, 'fred', 'no change to string variable');
35 ok( !readonly($var), 'reference to constant');
36 ok( readonly($$var), 'de-reference to constant');
38 ok( !readonly(*STDOUT), 'glob');
48 local $TODO = $Config::Config{useithreads} ? "doesn't work with threads" : undef;
49 ok( try ("abc"), 'reference a constant in a sub');
51 ok( !try ($var), 'reference a non-constant in a sub');