#!...perl -T use strict; eval { # entire script as before but try 'require CGI' instead of 'use' }; deal_with_problem($@) if $@; sub deal_with_problem { # mail, print feedback page, etc }