1 |
## ------------------------------------------------------------------------ |
2 |
## $Id: Exception.pm,v 1.1 2003/02/19 00:35:09 joko Exp $ |
3 |
## ------------------------------------------------------------------------ |
4 |
## $Log: Exception.pm,v $ |
5 |
## Revision 1.1 2003/02/19 00:35:09 joko |
6 |
## + initial commit |
7 |
## |
8 |
## ------------------------------------------------------------------------ |
9 |
|
10 |
|
11 |
package DesignPattern::Exception; |
12 |
|
13 |
use strict; |
14 |
use warnings; |
15 |
|
16 |
|
17 |
use base qw( DesignPattern::Object ); |
18 |
|
19 |
sub checkExceptions { |
20 |
my $self = shift; |
21 |
|
22 |
# behaviour A: die on error |
23 |
#die ($@) if $@; |
24 |
|
25 |
# behaviour B: log the error message as a warning |
26 |
if ($@) { |
27 |
if ($self->can('log')) { |
28 |
$self->log($@, 'warning'); |
29 |
} else { |
30 |
#print "warning: ", $@, "\n"; |
31 |
#print "warning: ", $@, "\n"; |
32 |
$self->log_basic($@, 'warning'); |
33 |
} |
34 |
} |
35 |
|
36 |
} |
37 |
|
38 |
1; |
39 |
__END__ |