1Razor2::Errorhandler(3)User Contributed Perl DocumentatioRnazor2::Errorhandler(3)
2
3
4

NAME

6       Razor::Errorhandler - Error handling mechanism for Razor.
7

SYNOPSIS

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
24           package main;
25
26           use Foo;
27           my $foo = new Foo;
28           $foo->alive($king) or print $foo->errstr();
29           # prints "Awake, awake! ... "
30

DESCRIPTION

32       Razor::Errorhandler encapsulates the error handling mechanism used by
33       the modules in Razor bundle. Razor::Errorhandler doesn't have a
34       constructor and is meant to be inherited. The derived modules use its
35       two methods, error() and errstr(), to communicate error messages to the
36       caller.
37
38       When a method of the derived module fails, it calls $self->error() and
39       returns  to the caller. The error message passed to error() is made
40       available to the caller through the errstr() accessor. error() also
41       accepts a list of sensitive data that it wipes out (undef'es) before
42       returning.
43
44       The caller should never call errstr() to check for errors. errstr()
45       should be called only when a method indicates (usually through an undef
46       return value) that an error has occured. This is because errstr() is
47       never overwritten and will always contain a value after the occurance
48       of first error.
49

METHODS

51       error($mesage, ($wipeme, $wipemetoo))
52           The first argument to error() is $message which is placed in
53           $self->{errstr} and the remaining arguments are interpretted as
54           variables containing sensitive data that are wiped out from the
55           memory. error() always returns undef.
56
57       errstr()
58           errstr() is an accessor method for $self->{errstr}.
59

AUTHOR

61       Vipul Ved Prakash, <mail@vipul.net>
62

SEE ALSO

64       Razor::Client(3)
65
66
67
68perl v5.38.0                      2023-07-21           Razor2::Errorhandler(3)
Impressum