in reply to Net::SSLeay and SESSION-ID
Actually you need to call get1_session rather than get_session so that the reference count of the session object is not decreased and it is not freed from memory. get1_session is absent from SSLeay.xs however you can add it using the get_session prototype. See "Network Security with OpenSSL", page 152.