Razor2::Errorhandler(3pm)

Razor2::Errorhandler3pm

Error handling mechanism for razor.

Usage

    package Foo;
    use Razor::Errorhandler;
    @ISA = qw(Razor::Errorhandler);
    sub alive { 
        ..
        ..
        return 
        $self->error ("Awake, awake! Ring the alarum bell. \
                       Murther and treason!", $dagger) 
            if $self->murdered($king);
    }
    package main; 
    use Foo;
    my $foo = new Foo;
    $foo->alive($king) or print $foo->errstr(); 
    # prints "Awake, awake! ... "

Overview

Razor::Errorhandler encapsulates the error handling mechanism used by the modules in Razor bundle. Razor::Errorhandler doesn't have a constructor and is meant to be inherited. The derived modules use its two methods, error() and errstr(), to communicate error messages to the caller.

When a method of the derived module fails, it calls $self->error() and returns to the caller. The error message passed to error() is made available to the caller through the errstr() accessor. error() also accepts a list of sensitive data that it wipes out (undef'es) before returning.

The caller should never call errstr() to check for errors. errstr() should be called only when a method indicates (usually through an undef return value) that an error has occured. This is because errstr() is never overwritten and will always contain a value after the occurance of first error.

Methods

error($mesage, ($wipeme, $wipemetoo))

The first argument to error() is $message which is placed in $self->{errstr} and the remaining arguments are interpretted as variables containing sensitive data that are wiped out from the memory. error() always returns undef.

errstr()

errstr() is an accessor method for $self->{errstr}.

Releases

12 releases since Debian 3.1 (Sarge); the text changed 11 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 8
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13
  12. Arch

Author

Vipul Ved Prakash, <[email protected]>

From razor 2.88-2 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.