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

Hello,

Since upgrading Perl yesterday I've been getting this error message:

weaken is only available with the XS version of Scalar::Util at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Class/MOP.pm line 12

I updated the module as some web pages suggest:

cpan> force install Task::Weaken

But I still get the same error message. Any help is highly appreciated!

Replies are listed 'Best First'.
Re: weaken is only available with the XS version
by cavac (Prior) on Dec 12, 2011 at 19:16 UTC

    Tho quote the documentation:

    Scalar::Util contains both perl and C implementations of many of its functions so that those without access to a C compiler may still use it. However some of the functions are only available when a C compiler was available to compile the XS version of the extension.

    Therefore, what you need is a C compiler installed and probably the perl header files (dev packets in your distribution or operating system?). Install that and then reinstall Scalar::Util.

    Don't use '#ff0000':
    use Acme::AutoColor; my $redcolor = RED();
    All colors subject to change without notice.
      It works now. Thanks very much!
Re: weaken is only available with the XS version
by Khen1950fx (Canon) on Dec 12, 2011 at 20:39 UTC
    You can always check to see if it's there:
    #!/usr/bin/perl -l use strict; use warnings; use List::Util::XS; print $List::Util::XS::VERSION;
    And here's a bundle to ensure that you have weakly things:
    #!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->install(qw( Task::Weaken Cache::Weak Class::IntrospectionMethods Class::WeakSingleton Class::Observable Clone::Closure Convert::Scalar Data::Decycle Data::Dump::Streamer Data::Structure::Util Devel::Cycle EO::WeakArray FCGI::EV Hash::NoRef IO::Plumbing Object::InsideOut Memoize::Expire::ByInstance Scalar::Util Set::Object Test::Memory::Cycle Test::NoXS Test::Weaken Test::Weaken::ExtraBits Tie::RefHash Tie::RefHash::Weak Tie::Util Util::Any WeakRef WeakRef::Auto));
Re: weaken is only available with the XS version
by Anonymous Monk on Dec 12, 2011 at 22:48 UTC
    The bigger issue is that, to you or your organization, upgrading Perl means installing a version which was EOL'd quite a while ago.

      This is not uncommon. (For good or ill.)