You can use the prerun_mode() method to change the run mode of your CGI::App.
In reply to Re: Changing run mode in cgi::application by matthewb in thread Changing run mode in cgi::application by BUU