http://www.perlmonks.org?node_id=1027262


in reply to combination of multiple installed Perls and some environment variables cause segfaults

XS modules compiled for one version of Perl are likely to segfault other Perls. (Though recently p5p have been ensuring binary compatibility across minor versions - i.e. 5.16.0, 5.16.1, 5.16.2 and 5.16.3 should all be binary compatible.)

The problem with PERL5LIB is that environment variables get passed to child processes, so when your Perl 5.14 spawns Perl 5.10, Perl 5.10 sees a lib dir that was intended for 5.14.

You could try adding this near the top of your script:

BEGIN { delete $ENV{PERL5LIB} };

Or you could avoid setting that variable to begin with and instead use lib or use the Perl -I command-line option.

Personally though, I'd suggest App::perlbrew which makes managing multiple versions of Perl a breeze.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name