diff options
Diffstat (limited to 'perl/Wallet/Server.pm')
-rw-r--r-- | perl/Wallet/Server.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/perl/Wallet/Server.pm b/perl/Wallet/Server.pm index 1fa7e4a..b6ce92f 100644 --- a/perl/Wallet/Server.pm +++ b/perl/Wallet/Server.pm @@ -18,13 +18,12 @@ use vars qw(%MAPPING $VERSION); use Wallet::ACL; use Wallet::Config; -use Wallet::Object::Keytab; use Wallet::Schema; # This version should be increased on any code change to this module. Always # use two digits for the minor version with a leading zero if necessary so # that it will sort properly. -$VERSION = '0.03'; +$VERSION = '0.04'; ############################################################################## # Utility methods @@ -139,7 +138,7 @@ sub DESTROY { ############################################################################## # Given an object type, return the mapping to a class by querying the -# database, or undef if no mapping exists. +# database, or undef if no mapping exists. Also load the relevant module. sub type_mapping { my ($self, $type) = @_; my $class; @@ -153,6 +152,17 @@ sub type_mapping { $self->{dbh}->rollback; return; } + if (defined $class) { + if ($class !~ /^Wallet::Object::(\w+::)*\w+\z/) { + $self->error ("invalid class name $class for type $type"); + return; + } + eval "require $class"; + if ($@) { + $self->error ($@); + return; + } + } return $class; } |