Subject: | Const::Fast won't make top-level references read-only |
_make_readonly() chases references, but the top level const() sub does
not:
$ perl -le 'use strict; use warnings; use Const::Fast; my $hashref = {
"foo" => "bar", "baaz" => "quux" }; const($hashref => $hashref); '
Can't make variable readonly at -e line 1
$ perl -le 'use strict; use warnings; use Const::Fast; my $arrayref = [
1, 2, 3, 4 ]; const($arrayref => $arrayref); '
Can't make variable readonly at -e line 1
ski@anito:~/mysrc/comma$ perl -le 'use strict; use warnings; use
Const::Fast; my $val = 3; my $scalarref = \$val; const($scalarref =>
$scalarref);'
Can't make variable readonly at -e line 1
$ perl -le 'use strict; use warnings; use Const::Fast; my $a = \{};
const($a => $a);'
Can't make variable readonly at -e line 1
$ perl -le 'use strict; use warnings; use Const::Fast; my $a = bless( \
{}, "FOO" );const($a => $a);'
Can't make variable readonly at -e line 1
... etc. seems to me like this is a bug, or at least something that
should be documented / overridable with an option to const().