1Razor2::Errorhandler(3)User Contributed Perl DocumentatioRnazor2::Errorhandler(3)
2
3
4
6 Razor::Errorhandler - Error handling mechanism for Razor.
7
9 package Foo;
10
11 use Razor::Errorhandler;
12 @ISA = qw(Razor::Errorhandler);
13
14 sub alive {
15 ..
16 ..
17 return
18 $self->error ("Awake, awake! Ring the alarum bell. \
19 Murther and treason!", $dagger)
20 if $self->murdered($king);
21 }
22
23 package main;
24
25 use Foo;
26 my $foo = new Foo;
27 $foo->alive($king) or print $foo->errstr();
28 # prints "Awake, awake! ... "
29
31 Razor::Errorhandler encapsulates the error handling mechanism used by
32 the modules in Razor bundle. Razor::Errorhandler doesn't have a con‐
33 structor and is meant to be inherited. The derived modules use its two
34 methods, error() and errstr(), to communicate error messages to the
35 caller.
36
37 When a method of the derived module fails, it calls $self->error() and
38 returns to the caller. The error message passed to error() is made
39 available to the caller through the errstr() accessor. error() also
40 accepts a list of sensitive data that it wipes out (undef'es) before
41 returning.
42
43 The caller should never call errstr() to check for errors. errstr()
44 should be called only when a method indicates (usually through an undef
45 return value) that an error has occured. This is because errstr() is
46 never overwritten and will always contain a value after the occurance
47 of first error.
48
50 error($mesage, ($wipeme, $wipemetoo))
51 The first argument to error() is $message which is placed in
52 $self->{errstr} and the remaining arguments are interpretted as
53 variables containing sensitive data that are wiped out from the
54 memory. error() always returns undef.
55
56 errstr()
57 errstr() is an accessor method for $self->{errstr}.
58
60 Vipul Ved Prakash, <mail@vipul.net>
61
63 Razor::Client(3)
64
65
66
67perl v5.8.8 2005-05-09 Razor2::Errorhandler(3)