In the Carp man pages it states that croak and confess do...
     croak   - die of errors (from perspective of caller)
     confess - die of errors with stack backtrace

but I don't see any difference in how they work.

I wrote a little test program as follows...

use Carp;
print "test1\n";
eval { a(); };
warn $@ if $@;
print "\ntest2\n";
eval { d(); };
warn $@ if $@;
sub a { b(); }
sub b { c(); }
sub c { croak 'croak in c'; }
sub d { e(); }
sub e { f(); }
sub f { confess 'confess in f'; }

... and ran it.  It produced the following output....

test1
croak in c at testit line 12
        main::c() called at testit line 11
        main::b() called at testit line 10
        main::a() called at testit line 4
        eval {...} called at testit line 4

test2
confess in f at testit line 16
        main::f() called at testit line 15
        main::e() called at testit line 14
        main::d() called at testit line 7
        eval {...} called at testit line 7

What is the real difference here?

_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to