Skip Menu |

This queue is for tickets about the Class-Container CPAN distribution.

Report information
The Basics
Id: 5517
Status: resolved
Priority: 0/
Queue: Class-Container

People
Owner: Nobody in particular
Requestors: mdorman [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.10
Fixed in: (no value)



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";
Hi Michael, The bug isn't as weird as you might think. =) Try this simpler test to see what's going on: my $x = 5; BEGIN { $x = 4; } print $x; I'll make the fix to Class::Container, thanks for pointing it out. -Ken