install Scalar::Util XS version.

Qiang on 2007-02-21T20:28:21

Weak references are not implemented in the version of perl that is the error i got when installing Task::Weaken (part of Perl::Critic prereq) which test if Scalar::Util has the XS weaken function. S::U on this system is pure-perl version. therefore the error msg.

the solution is to recompile Scalar::Util with XS support.

here is what i did to install Scalar::Util 's XS version to my HOME dir. soaris 8.

Scalar::Util uses Module::Install which uses $Config::Config{cc} which points to a non-existen location. %Config is read-only. ExtUtils::FakeConfig comes to rescue.

#pwd
/home/qiang/.cpan/build/Scalar-List-Utils-1.19

#cat my_Config.pm

package my_Config;

use ExtUtils::FakeConfig cc => 'gcc';

1;

#perl -Mmy_Config Makefile.PL PREFIX=/home/qiang/perl/ INSTALLDIRS=site
#make LD=gcc
#make test
#make install

lesson learned: i was trying to test the 'weak' function in Scalar-List-Utils-1.19 built directory after make by running perl -e 'use Scalar::Util qw(weaken)' which always give me error saying 'weaken function is not implemented in this version of perl'.

after a few failed tries, i did

% perldoc -l Scalar::Util
lib/Scalar/Util.pm

hmm. there is another copy of it under blib/.

% perl -e 'BEGIN{unshift @INC,"/home/qiangl/.cpan/build/Scalar-List-Utils-1.19/blib/lib"};use Scalar::Util qw(weaken)'

that worked. here I come, Perl::Critic