my $co = CoolObject->new(); # or if you want to trap the error... my $co = eval { CoolObject->new() }; if ($@) { # do something about the error }