perlopensslmojoliciouscpanmlibressl

What is the right way to install IO::Socket::SSL using Carton and custom LibreSSL/OpenSSL


Perl framework Mojolicious uses optional module IO::Socket::SSL for secured connections.

Mojolicious and IO::Socket::SSL must be installed using Carton (cpanfile contains dependencies list).
In order to use IO::Socket::SSL I need to have Net::SSLeay installed.
Net::SSLeay requires LibreSSL or OpenSSL installed.

On developer's server, a determined Perl project must use a determined LibreSSL/OpenSSL version:

$HOME/opt/LibreSSL/v1
$HOME/opt/LibreSSL/v...
$HOME/opt/OpenSSL/v1
$HOME/opt/OpenSSL/v...

My solution is to change $PATH system variable (for local custom LibreSSL/OpenSSL) before:

- execution "carton install" command
- running of a Perl project for testing

Is it right way?


Solution

  • Determining what instance of OpenSSL to link against is done by Net::SSLeay during its installation (IO::Socket::SSL is just an interface to that module). It explains in its README:

        If your OpenSSL is installed in an unusual place, you can tell
        Net-SSLeay where to find it with the OPENSSL_PREFIX environment
        variable:
        OPENSSL_PREFIX=/home/mikem/playpen/openssl-1.0.2c perl Makefile.PL
    

    Once installed, this no longer needs to be indicated to the respective Perl projects using that module.