if (-e path/MyController.pm) { use MyController; } else { use DefController; } my $cont = new MyController || newDefController;