system perl module XML::LibXSLT is not working in macOS 11.4: symbol '_exsltRegisterAll' not found, expected in flat namespace

I am on macOS 11.4:

$ perl --version
This is perl 5, version 30, subversion 2 (v5.30.2) built for darwin-thread-multi-2level
$ which perl
/usr/bin/perl
$ perl -MXML::LibXSLT -e1
Can't load '/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/XML/LibXSLT/LibXSLT.bundle' for module XML::LibXSLT: dlopen(/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/XML/LibXSLT/LibXSLT.bundle, 0x0001): symbol '_exsltRegisterAll' not found, expected in flat namespace by '/System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/XML/LibXSLT/LibXSLT.bundle' at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197.
 at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/XML/LibXSLT.pm line 48.
BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/XML/LibXSLT.pm line 48.
Compilation failed in require.
BEGIN failed--compilation aborted.

Note that the module XML::LibXSLT comes preinstalled (it is not a module that I installed myself). This module works fine in macOS 11.2.3, so the issue is probably introduced in 11.3 or 11.4.

I ran into this same problem last night. I found a temporary solution on StackOverflow using Perlbrew (https://stackoverflow.com/a/67924642).

If you find a better solution, please share what you found. Thank you!

system perl module XML::LibXSLT is not working in macOS 11.4: symbol '_exsltRegisterAll' not found, expected in flat namespace
 
 
Q