--- nfo/perl/libs/DesignPattern/Bridge.pm 2003/02/20 20:50:32 1.10 +++ nfo/perl/libs/DesignPattern/Bridge.pm 2003/02/21 08:38:21 1.11 @@ -1,7 +1,11 @@ ## -------------------------------------------------------------------------------- -## $Id: Bridge.pm,v 1.10 2003/02/20 20:50:32 joko Exp $ +## $Id: Bridge.pm,v 1.11 2003/02/21 08:38:21 joko Exp $ ## -------------------------------------------------------------------------------- ## $Log: Bridge.pm,v $ +## Revision 1.11 2003/02/21 08:38:21 joko +## + additional checks +## + raising exceptions +## ## Revision 1.10 2003/02/20 20:50:32 joko ## + small exception handling: now inheriting from little Exception object ## @@ -48,6 +52,7 @@ DesignPattern::Exception ); + use Data::Dumper; ## ======== object inheritance ======== @@ -279,9 +284,21 @@ my $self = shift; my $includefile = shift; my $package = shift; - # TODO: do better error-detection here / prevent dies under all circumstances! - require $includefile; + + # pre-flight checks + if (!$includefile) { + $self->raiseException('Filename for inclusion was empty.'); + return; + } + + # go for it ... + eval("require '$includefile';"); + # ... and handle errors afterwards catching every message from perl itself ... + return if $self->checkExceptions(); + + # ... otherwise continue assuming everything is fine $self->mixinPackage($package) if $package; + } 1;