/[cvs]/nfo/perl/libs/DesignPattern/Exception.pm
ViewVC logotype

Contents of /nfo/perl/libs/DesignPattern/Exception.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu Feb 20 20:53:55 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.1: +15 -3 lines
+ fix: using Object's basic log method if not running together with the Logger

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__

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed