2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.10 2003/05/13 08:46:08 joko |
6 |
|
## pod and comments |
7 |
|
## |
8 |
|
## Revision 1.9 2003/03/27 15:44:32 joko |
9 |
|
## fixes/enhancements to 'sub log_basic' |
10 |
|
## |
11 |
## Revision 1.8 2003/02/19 00:36:59 joko |
## Revision 1.8 2003/02/19 00:36:59 joko |
12 |
## + bugfix: this {logger} is the instance itself, so has to be fed with ( level => xyz and namespace => xyz ) |
## + bugfix: this {logger} is the instance itself, so has to be fed with ( level => xyz and namespace => xyz ) |
13 |
## + minor modifications in behaviour |
## + minor modifications in behaviour |
35 |
## |
## |
36 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
37 |
|
|
38 |
|
=pod |
39 |
|
|
40 |
|
=head1 NAME |
41 |
|
|
42 |
|
DesignPattern::Object |
43 |
|
|
44 |
|
|
45 |
|
=head1 TODO |
46 |
|
|
47 |
|
o use Class::Loader |
48 |
|
|
49 |
|
|
50 |
|
=cut |
51 |
|
|
52 |
package DesignPattern::Object; |
package DesignPattern::Object; |
53 |
|
|
184 |
eval($evstring); |
eval($evstring); |
185 |
|
|
186 |
# report errors |
# report errors |
187 |
|
# Could this be united with DesignPattern::Loader::checkExceptions? |
188 |
if ($@) { |
if ($@) { |
189 |
# build error-messages |
# build error-messages |
190 |
my $issuer = __PACKAGE__ . ':' . __LINE__; |
my $issuer = __PACKAGE__ . ':' . __LINE__; |
205 |
# object-creation |
# object-creation |
206 |
my $object = $pkgname->new(@args); |
my $object = $pkgname->new(@args); |
207 |
|
|
208 |
|
# trace |
209 |
|
#print Dumper($object); |
210 |
|
|
211 |
# run boot-methods on object |
# run boot-methods on object |
212 |
$object->_init() if $object->can('_init'); |
$object->_init() if $object->can('_init'); |
213 |
$object->constructor() if $object->can('constructor'); |
$object->constructor() if $object->can('constructor'); |
223 |
#return; |
#return; |
224 |
$level ||= 'info'; |
$level ||= 'info'; |
225 |
|
|
226 |
if ($_dp_globals->{TRACE} || ($level && $level =~ /warning|error|critical/)) { |
my $notSoGood = ($level =~ /warning|error|critical/); |
227 |
|
|
228 |
|
# STDERR? |
229 |
|
if ($level && $notSoGood) { |
230 |
|
print STDERR $level, ": ", $message, "\n"; |
231 |
|
} |
232 |
|
|
233 |
|
# STDOUT? |
234 |
|
if ($_dp_globals->{TRACE} || $notSoGood) { |
235 |
print $level, ": ", $message, "\n"; |
print $level, ": ", $message, "\n"; |
236 |
} |
} |
237 |
|
|