I found this solution on the misc@ list, and just slightly had to update it:

 Getting Perl/CGI to work in a chroot'd Apache environment :IntentionsLet me start off by saying that allowing Perl/CGI in a serverenvironment is generally a not good idea, unless you like tospend all of your time auditing the Perl/CGI scripts on yourwebserver. Lets face it - a lot of the Perl/CGI code out thereis very poorly written security wise and can present a seriousthreat to your business or organization. Crackers know this andwill try to exploit the vulnerabilities in your Perl/CGI scriptsto gain access to your system(s).Nonetheless, since the OpenBSD 3.2 release with the defaultchroot'd Apache, I have been getting a lot of e-mails regardingproblems that users and admins have encountered. For example,admins like the idea of running Apache in chroot, but theirwebsites rely heavily upon multiple Perl/CGI scripts. With Apacherunning in chroot, Perl/CGI will obviously not work by default.The dillema here, is that admins do not want to sacrifice thesecurity of running chroot'd Apache, but at the same time, theycannot operate their business or oganization successfully withoutthe Perl/CGI applications. So, this paper was written specificallyfor that reason - being able to run Apache in chroot with Perl/CGIcapabilities.* RequirementsThis document is specifically written for users and admins ofOpenBSD=>3.2 with chroot'd Apache, but it can be applied toother operating systems/distributions if the Apache setup followsthe OpenBSD chroot'd Apache setup. If you are an experiencedadmin running a different operating system/distribution, thisdocument can give you the general idea on what to do.+ OpenBSD=>3.2+ Perl+ Default chroot'd Apache* InstructionsBy default, chroot'd Apache is in /var/www. Since Apache cannotsee outside /var/www, we will have to recreate a few directoriesfor Perl, so it could still be called from scripts with#!/usr/bin/perl :root@openwire # cd /var/wwwroot@openwire # mkdir usr; mkdir usr/lib; mkdir usr/libexec; mkdir usr/binNow that the directories have been created, we have to see whatlibraries perl depends on :root@openwire # ldd /usr/bin/perl/usr/bin/perl:-lperl.8 => /usr/lib/libperl.so.8.0 (0x4001d000)-lm.1 => /usr/lib/libm.so.1.0 (0x400fa000)-lc.29 => /usr/lib/libc.so.29.0 (0x4010e000)-lutil.8 => /usr/lib/libutil.so.8.0 (0x401cc000)Copy those libraries to the correct directories in /var/www/usr/* :root@openwire # cp /usr/lib/libperl.so.8.0 /var/www/usr/lib/root@openwire # cp /usr/lib/libm.so.1.0 /var/www/usr/lib/root@openwire # cp /usr/lib/libc.so.29.0 /var/www/usr/lib/root@openwire # cp /usr/lib/libutil.so.8.0 /var/www/usr/lib/Copy ld.so to /var/www/usr/libexec :root@openwire # cp /usr/libexec/ld.so /var/www/usr/libexec/Copy perl to /var/www/usr/bin :root@openwire # cp /usr/bin/perl /var/www/usr/binNow adjust your /var/www/conf/httpd.conf file as usually byadding :AddHandler cgi-script .cgiScriptAlias /cgi-bin/ "/var/www/cgi-bin/"AllowOverride NoneOptions Indexes FollowSymLinks ExecCGIOrder allow,denyAllow from allRestart Apache :root@openwire # apachectl restart/usr/sbin/apachectl restart: httpd restartedAs well as what others have mentioned, you may find that  apachectl restartdoesn't quite work the same because the restart is already chrooted.Any problems:  apachectl stop; sleep 1; apachectl startmay solve.That's it. If you have done everything as said in this document,you should have access to Perl/CGI on your chroot'd Apache.Good luck.* CreditsThis document is Copyright 2003 by Daniel Selans (metawire systemadministrator)Dom De Vitto has contributed the apachectl restart workaround.