| 2 |
## $Id$ |
## $Id$ |
| 3 |
## -------------------------------------------------------------------------------- |
## -------------------------------------------------------------------------------- |
| 4 |
## $Log$ |
## $Log$ |
| 5 |
|
## Revision 1.11 2003/02/21 08:38:21 joko |
| 6 |
|
## + additional checks |
| 7 |
|
## + raising exceptions |
| 8 |
|
## |
| 9 |
## Revision 1.10 2003/02/20 20:50:32 joko |
## Revision 1.10 2003/02/20 20:50:32 joko |
| 10 |
## + small exception handling: now inheriting from little Exception object |
## + small exception handling: now inheriting from little Exception object |
| 11 |
## |
## |
| 52 |
DesignPattern::Exception |
DesignPattern::Exception |
| 53 |
); |
); |
| 54 |
|
|
| 55 |
|
|
| 56 |
use Data::Dumper; |
use Data::Dumper; |
| 57 |
|
|
| 58 |
## ======== object inheritance ======== |
## ======== object inheritance ======== |
| 284 |
my $self = shift; |
my $self = shift; |
| 285 |
my $includefile = shift; |
my $includefile = shift; |
| 286 |
my $package = shift; |
my $package = shift; |
| 287 |
# TODO: do better error-detection here / prevent dies under all circumstances! |
|
| 288 |
require $includefile; |
# pre-flight checks |
| 289 |
|
if (!$includefile) { |
| 290 |
|
$self->raiseException('Filename for inclusion was empty.'); |
| 291 |
|
return; |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
# go for it ... |
| 295 |
|
eval("require '$includefile';"); |
| 296 |
|
# ... and handle errors afterwards catching every message from perl itself ... |
| 297 |
|
return if $self->checkExceptions(); |
| 298 |
|
|
| 299 |
|
# ... otherwise continue assuming everything is fine |
| 300 |
$self->mixinPackage($package) if $package; |
$self->mixinPackage($package) if $package; |
| 301 |
|
|
| 302 |
} |
} |
| 303 |
|
|
| 304 |
1; |
1; |