Is it better to croak() or to die() when something bad happens in Perl?

后端 未结 6 1207
无人及你
无人及你 2021-02-18 22:12

perlcritic complaints that the following code, some boilerplate DBI stuff that works perfectly fine, should croak instead of die:

# Connect to database
my $db_ha         


        
6条回答
  •  南笙
    南笙 (楼主)
    2021-02-18 22:37

    The Carp routines are useful in your own modules because they act like die() or warn(), but with a message which is more likely to be useful to a user of your module.

    https://perldoc.perl.org/Carp

提交回复
热议问题