Booger has asked for the wisdom of the Perl Monks concerning the following question:


I've coddled together some Perl modules for a small app in-house app at work. I coded the app on a FreeBSD box and am having some problems moving the app to a Red Hat Enterprise box.

The app works perfectly on the FreeBSD box but dies horribly on the Red Hat box. The versions of Perl are 5.8.5 and 5.8.0, respectively.

When I try to run the app on the RHE box I get the following error:

Weak references are not implemented in the version of perl at Class/Ob line 7

I'm trying to figure out why this is happening. AFAIK, weak references were implemented in Perl as of 5.6.x and this shouldn't be a problem for me.

Any suggestions as to how I might fix this error would be greatly appreciated.

FWIW, the most recent version of Scalar::Util is installed on both boxes.

Replies are listed 'Best First'.
Re: Weak references are not implemented
by samtregar (Abbot) on Jan 24, 2005 at 18:28 UTC
    I've seen this happen and it was caused by using a copy of Scalar::Util which was compiled using an older version of Perl. Scalar::Util decides at install-time whether Perl has weaken() or not.

    You can find out which copy of Scalar::Util you're using by looking at %INC:

       perl -MScalar::Util -MData::Dumper -e 'print Dumper(\%INC)'


      Perhaps another (clumsily missed) cause can be user rights?

      I had the latest version of modules etc, and perl 5.8.5 (5.6.0+ required), and was still getting the "weak references not implemented" error.

      After trying (in vain) the suggestions here I ran the script as root, and voilá! Problem gone! D'oh!

      HTH, Tony

Re: Weak references are not implemented
by perrin (Chancellor) on Jan 24, 2005 at 22:31 UTC
    I recall having problems with Red Hat's Perl not being compiled for weak references. I don't know of any workaround short of compiling your own perl.
      I'd compile my own version of Perl on most Redhats anyways ... (threaded perl)--

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re: Weak references are not implemented
by Anonymous Monk on Jan 25, 2005 at 09:31 UTC
    By the way, Perl 5.8.0 is ghost release, since it has to much bugs! You should use at least 5.8.1, but 5.8.5+ is much better.
Re: Weak references are not implemented
by Steve_p (Priest) on Jan 25, 2005 at 14:30 UTC

    There are a lot of problems with the Perl 5.8.0 especially on RedHat. I'd suggest upgrading or compiling a new Perl on your own for that server.

Re: Weak references are not implemented
by xorl (Deacon) on Nov 15, 2007 at 12:15 UTC
    I just encountered this problem today. The solution was to do a reinstall from CPAN (not from RH) of Scalar::Util
    perl -MCPAN -e shell force install Scalar::Util
      Forcing a reinstall of Scalar::Util on Centos 4.x solved the problem for me too.

      also solved the problem in a Ubuntu 6.06.2 LTS.

      many thanks
        Wow - force reinstalling worked brilliantly, fedora core- nice simple solution. Thanks. Surprised Redhat haven't shipped a fixed version of perl...
      OS X 10.5.6 - looks like February 2009 security update (2009-001) also broke this - and "force install Scalar::Util" fixed it. Thanks!
Re: Weak references are not implemented
by sblanton (Sexton) on Oct 24, 2008 at 14:37 UTC
    I have this problem on ActivePerl 5.8.8 (build 820). Is there no hope?
    The latest version, 1.19 is installed. Doing a forced reinstall hasn't helped.
      Earlier and later ActiveState builds of Perl 5.8.8 both support weaken:

      Build 817:

      >perl -e"use Scalar::Util qw( weaken );" >

      Build 824:

      >perl -e"use Scalar::Util qw( weaken );" >

      So either

      • ActiveState messed up for build 820.,
      • you have a botched install (Util.dll isn't in lib/auto/List/ or site/lib/auto/List/), or
      • something is causing perl to be unable to locate Util.dll in lib/auto/List/ or site/lib/auto/List/
      Windows, that is.
      Install 5.10 ??
        Yes, going to Windows activeperl 5.10 (build 1004) resolved this issue. Thanks.
Re: Weak references are not implemented
by bobbyburgess (Initiate) on Nov 18, 2008 at 14:47 UTC
    Forcing a reinstall of Scalar::Util resolved this problem for me on CentOS 5.2. The problem arose immediately after I did a 'yum update all' on the box, so that must've broken it.
Re: Weak references are not implemented
by rethgir (Initiate) on Dec 19, 2008 at 18:26 UTC
    Just wanted to add that doing a force install Scalar::Util did the trick for me, running Fedora 7 -- what a life saver!
      force install Scalar::Util also did the trick on Solaris 10