Because last time I had to carry out such an upgrade, I found myself in a strange (better say nightmare) situation in which a local installation of Scalar::Util (if I remember well) was one of the XS modules blocking practically the execution of 70% of the library , including the standard cpan(1) script from executing (which resulted in practically re-installing the whole library), I thought better ask this time and plan for the worst: is there any recommended/battle-tested way to proceed with XS modules rebuilding after an upgrade?

Scalar::Util is a dual-life module which is in the Perl core as well as on CPAN. It should be installed together with Perl. I always install Perl from the source code, and I always install it into my user space. I'm not sure what kind of problems you might be having, but when I install Perl I don't allow it to use the old versions of libraries, that is when the configure script asks if it is OK to use the old libraries I say "no" (the default is to use the old libraries). That means I have to update every module from CPAN which I'm using, but it seems to work better that way.

If the CPAN script stops working you can always download the tarfile from metacpan and then go into the directory and do "perl Makefile.PL;make;make test;make install" to install it yourself.

I did look at finding a way to reliably find all and only the XS modules in my local lib but I hadn't any luck. Any suggestions?

Yes, I have a suggestion since I frequently have to update just the XS modules on a web host when they change the version of Perl. To find the XS modules you have installed, go to your local library directory where Perl modules are installed, and run the following command:

find . -name "*.so"

That will produce a list of modules, for example like this:

[ben@mikan] {16:33 45} site_perl 508 $ cd 5.32.1/ /home/ben/software/install/lib/perl5/site_perl/5.32.1 [ben@mikan] {16:33 50} 5.32.1 509 $ find . -name "*.so" ./i386-freebsd/auto/Test/Taint/Taint.so ./i386-freebsd/auto/Term/ReadKey/ReadKey.so ./i386-freebsd/auto/JSON/Create/Create.so ./i386-freebsd/auto/JSON/Parse/Parse.so ./i386-freebsd/auto/JSON/JQ/JQ.so ./i386-freebsd/auto/Gzip/Libdeflate/Libdeflate.so ./i386-freebsd/auto/Gzip/Zopfli/Zopfli.so ./i386-freebsd/auto/PadWalker/PadWalker.so ./i386-freebsd/auto/XString/XString.so ./i386-freebsd/auto/Variable/Magic/Magic.so ./i386-freebsd/auto/B/Hooks/OP/Check/Check.so ./i386-freebsd/auto/DateTime/DateTime.so ./i386-freebsd/auto/Ref/Util/XS/XS.so ./i386-freebsd/auto/Mouse/Mouse.so ./i386-freebsd/auto/Time/timegm/timegm.so ./i386-freebsd/auto/PerlIO/gzip/gzip.so ./i386-freebsd/auto/indirect/indirect.so ./i386-freebsd/auto/multidimensional/multidimensional.so ./i386-freebsd/auto/bareword/filehandles/filehandles.so ./i386-freebsd/auto/NetAddr/IP/Util/Util.so ./i386-freebsd/auto/Email/Address/XS/XS.so ./i386-freebsd/auto/IP/Whitelist/Whitelist.so ./i386-freebsd/auto/Syntax/Keyword/Try/Try.so

Now here is a function which sorts out the output of that, as if the above text is all in $so. You will need to edit it to suit your situation:

sub update_from_so { my ($site, $so, $verbose) = @_; my @so = split /\n/, $so; my %so2f; for my $so (@so) { $_ = $so; chomp; s!\./auto/!!; s!(/([^/]+))/\2\.so!$1!; s!/!-!; if ($verbose) { print "Looking for $_...\n"; } my ($dir, $file) = module_to_file ($_); if ($verbose) { print "Found $_ as '$dir/$file'\n"; } if (! -f $file) { my $cwd = getcwd (); chdir $dir or die $!; do_system ("./build.pl -d"); if (! -f $file) { die "Could not recreate file $file\n"; } chdir $cwd or die $!; } $so2f{$so} = [$dir, $file]; } for my $so (@so) { my ($dir, $file) = @{$so2f{$so}}; my $cwd = getcwd (); chdir $dir or die $!; if (! -f $file) { die "$dir: No $file"; } do_system ("$site-module-build.pl $file"); chdir $cwd or die $!; } }

The above Perl code will not run "as-is" but should be a fairly useful basis for getting started.


In reply to Re: Dealing with perl upgrade and local XS modules by no longer just digit
in thread Dealing with perl upgrade and local XS modules by markong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.