in reply to apache2 passing PERL5LIB environment to cgi
Have you verified that the apache user had the rights to read your ~/lib directory?