-=func load_xs
-
- $bool = load_xs();
- $bool = load_xs($version);
-
-Attempt to load L<File::KDBX::XS>. Return truthy if C<XS> is loaded. If C<$version> is given, it will check
-that at least the given version is loaded.
-
-=cut
-
-sub load_xs {
- my $version = shift;
-
- require File::KDBX;
-
- my $has_xs = File::KDBX->can('XS_LOADED');
- return $has_xs->() && ($version ? eval { File::KDBX::XS->VERSION($version); 1 } : 1) if $has_xs;
-
- my $try_xs = 1;
- $try_xs = 0 if $ENV{PERL_ONLY} || (exists $ENV{PERL_FILE_KDBX_XS} && !$ENV{PERL_FILE_KDBX_XS});
-
- my $use_xs = 0;
- $use_xs = try_load_optional('File::KDBX::XS') if $try_xs;
-
- *File::KDBX::XS_LOADED = *File::KDBX::XS_LOADED = $use_xs ? sub() { 1 } : sub() { 0 };
- return $version ? eval { File::KDBX::XS->VERSION($version); 1 } : 1;
-}
-