Subject: [PATHCH] Scalar::Util::readonly & compression (was RE: Change 29117: [PATCH] IO::Compress modules)
From: "Paul Marquess" <paul.marquess@ntlworld.com>
Message-ID: <
02cf01c6fb9d$ade808a0$6501a8c0@myopwv.com>
p4raw-id: //depot/perl@29261
}
use Scalar::Util qw(readonly);
-use Test::More tests => 9;
+use Test::More tests => 11;
ok( readonly(1), 'number constant');
ok( readonly($$var), 'de-reference to constant');
ok( !readonly(*STDOUT), 'glob');
+
+sub try
+{
+ my $v = \$_[0];
+ return readonly $$v;
+}
+
+$var = 123;
+ok( try ("abc"), 'reference a constant in a sub');
+ok( !try ($var), 'reference a non-constant in a sub');
+