Are you sure that this 'use
lib' pragma is what is causing your 500 error? You may want to examine the server's error logs for details about 500 Server Errors. You may also be interested in
CGI::Carp, which will send your script's fatal errors to the browser instead of someplace like the server logs, which can be cumbersome for some ill-configured web installations:
use CGI::Carp 'fatalsToBrowser';
...