| Crypt-Mimetic documentation | Contained in the Crypt-Mimetic distribution. |
Error::Mimetic - The error class definition for Crypt::Mimetic(3) (see Error(3) module)
This module is a part of Crypt::Mimetic(3) distribution.
This module extends Error::Simple.
See Error(3) for details about methods not described below
Error::Mimetic constructor takes 3 arguments:
the first is the error description, the second are details and the last
is the type: error (default) or warning.
A method that converts the object into a string.
If $Error::Debug is == 0, then only description is printed.
If $Error::Debug is > 0, then details are printed after description.
If $Error::Debug is > 1, then description, details and informations about files and lines where error raised are printed.
Return error type: error (default) or warning.
This module needs: Error
Error(3), Crypt::Mimetic(3)
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself (Artistic/GPL2).
Erich Roncarolo <erich-roncarolo@users.sourceforge.net>
| Crypt-Mimetic documentation | Contained in the Crypt-Mimetic distribution. |
package Error::Mimetic; use Error; use strict; use vars qw($VERSION); $VERSION = '0.02';
@Error::Mimetic::ISA = qw(Error::Simple);
sub new { my ($self, $text, $details, $type) = @_; my $s = $self->SUPER::new($text,0); $s->{'-object'} = $details; $s->{'-type'} = "error"; $s->{'-type'} = $type if $type; return $s; }
sub stringify { my $self = shift; my $cache = $self->{'-cache'}; return $cache if $cache; my $obj = $self->{'-object'}; $self->{'-text'} .= ".\n" unless $Error::Debug > 1; my $s = $self->SUPER::stringify; if ($Error::Debug > 0 && $obj) { my @lines = split /\n/, $obj; chomp(@lines); $obj = $lines[0]; chomp $s; $s .= " - $obj"; chomp $s; if ($Error::Debug < 2) { $s =~ s/ at (\S+) line (\d+)(\.)*$//s || $s =~ s/ at \(.*?\) line (\d+)(\.)*$//s; } $s .= "\n"; } $self->{'-cache'} = $s; return $s; }
sub type { my $self = shift; return $self->{'-type'}; } 1; __END__