読者です 読者をやめる 読者になる 読者になる

IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

carp, cluck, croak, confessの違い

package B;
use Carp qw(carp cluck croak confess);

sub test {
   carp  'this is carp';
#   cluck 'this is cluck';
#   croak 'this is croak';
#   confess 'this is confess';
#   warn 'this is warn';
#   die 'this is die';
}

package main;
B::test();

#         Fatal  Backtrace
#carp       N        N
#cluck      N        Y
#croak      Y        N
#confess    Y        Y
carp this is carp at t.pl line 14 呼出し元 warn
cluck this is cluck at t.pl line 6
B::test() called at t.pl line 12
呼出し先 warn
croak this is croak at line 14 呼出し元 die
confess this is confess at line 8
B::test() called at line 12
呼出し先 die
warn this is warn at t.pl line 9. 呼出し先 warn
die this is die at line 10. 呼出し先 die