how-to fix the XS version of Scalar::Util error in CentOS / RHEL / Fedora

It’s being some month now that at work we have encountered a nasty problem with Perl’s module Compress::Zib usage in a tool developed by a colleague. At the moment to start the graphical rendering of a web page the system gave error to our users.

Searching in Apache2’s log I’ve encoutered many error of this kind:

dualvar is only available with the XS version of Scalar::Util at /var/www/html/$MY-APP-PATH/perl/Compress/Zlib.pm line 8

This is because the Scalar-List-Utils module precompiled in RHEL/Fedora/CentOS and similar does NOT have the support of XS weaken function.

You will see a lot of bugs issued on this topic in this part of Linux distro’s.

My solution was to install perl-Task-Weaken package:

In fact as we can read in the package’s description:

rpm -qi perl-Task-Weaken
...
URL         : http://search.cpan.org/dist/Task-Weaken/
Summary     : Ensure that a platform has weaken support
Description : One recurring problem in modules that use Scalar::Util's weaken function is that it is not present in the pure-perl variant.

This restores the functionality testing to a dependency you do once in your Makefile.PL, rather than something you have to write extra tests for each time you write a module.

Happy coding!

One thought on “how-to fix the XS version of Scalar::Util error in CentOS / RHEL / Fedora

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s