Subject: | Test for weaken doesn't appear to work on perl-5.8.3? |
On my stock Debian/testing install of perl-5.8.3, the test for the presence of Scalar::Util doesn't appear to work correctly---that is, Scalar::Util is not detected and use of ->container() causes an exception.
My hyper-minimal test script, attached, suggests that this is somehow the result of the test for Scalar::Util being in a BEGIN block, which seems improbable, but that's what I can observe.
I'd appreciate any guidance you might have.
#!/usr/bin/perl -w
my $HAVE_WEAKEN1 = 0;
BEGIN {
eval {
require Scalar::Util;
Scalar::Util->import('weaken');
$HAVE_WEAKEN1 = 1;
};
}
my $HAVE_WEAKEN2 = 0;
#BEGIN {
eval {
require Scalar::Util;
Scalar::Util->import('weaken');
$HAVE_WEAKEN2 = 1;
};
#}
print "First = $HAVE_WEAKEN1\nSecond = $HAVE_WEAKEN2\n";