1Clownfish::Err(3) User Contributed Perl Documentation Clownfish::Err(3)
2
3
4
6 Clownfish::Err - Exception.
7
9 package MyErr;
10 use base qw( Clownfish::Err );
11
12 ...
13
14 package main;
15 use Scalar::Util qw( blessed );
16 while (1) {
17 eval {
18 do_stuff() or MyErr->throw("retry");
19 };
20 if ( blessed($@) and $@->isa("MyErr") ) {
21 warn "Retrying...\n";
22 }
23 else {
24 # Re-throw.
25 die "do_stuff() died: $@";
26 }
27 }
28
30 Clownfish::Err is the base class for exceptions in the Clownfish object
31 hierarchy.
32
33 The Err module also provides access to a per-thread Err shared variable
34 via set_error() and get_error(). It may be used to store an Err object
35 temporarily, so that calling code may choose how to handle a particular
36 error condition.
37
39 cat_mess
40 $err->cat_mess($mess);
41
42 Concatenate the supplied argument onto the error message.
43
44 get_mess
45 my $string = $err->get_mess();
46
47 Return the error message.
48
50 Clownfish::Err isa Clownfish::Obj.
51
52
53
54perl v5.34.0 2022-01-21 Clownfish::Err(3)