use strict; use warnings; use Error qw(:try); use DB::DBException; try { throw DB::DBException("Connect exception"); print "OK\n"; } catch DB::DBException with { print "DBException"; } catch Error with { print "Error"; }; print "finished";