Index: /trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 20971)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 20972)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004-2008  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.94 2008-12-12 21:13:41 jhoblitt Exp $
+# $Id: Server.pm,v 1.95 2008-12-13 00:41:15 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -38,4 +38,12 @@
     my $config = Nebulous::Server::Config->new( @_ );
 
+    return $class->new_from_config($config);
+}
+
+
+sub new_from_config
+{
+    my ($class, $config) = @_;
+
     # log4perl is not avaliable until we call init()
     Nebulous::Server::Log->init($config);
@@ -52,8 +60,7 @@
 
     $log->debug( "leaving" );
-    
+
     return $self;
 }
-
 
 sub db
@@ -68,5 +75,7 @@
     if (defined $key) {
         # hash the key to select the correct database instance
-        $db_index = unpack("%20h", sha1_hex("$key")) % $config->n_db;
+        # only use the first 8 hex chars... have to be careful to avoid an int
+        # overflow here
+        $db_index = unpack("h8", sha1_hex("$key")) % $config->n_db;
     }
 
Index: /trunk/Nebulous-Server/lib/Nebulous/Server/SOAP.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server/SOAP.pm	(revision 20971)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server/SOAP.pm	(revision 20972)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SOAP.pm,v 1.4 2007-05-02 00:42:52 jhoblitt Exp $
+# $Id: SOAP.pm,v 1.5 2008-12-13 00:41:15 jhoblitt Exp $
 
 package Nebulous::Server::SOAP;
@@ -17,8 +17,10 @@
 our $AUTOLOAD;
 
-our @args;
+our $config;
 our $neb;
 
-sub new_on_init {
+
+sub new_on_init
+{
     my $self = shift;
 
@@ -27,5 +29,5 @@
     require Apache2::ServerUtil;
 
-    @args = @_;
+    $config = shift;
 
     my $s = Apache2::ServerUtil->server;
@@ -35,13 +37,17 @@
 }
 
-sub init {
+
+sub init
+{
     my $self = shift;
 
-    $neb = Nebulous::Server->new(@args);        
+    $neb = Nebulous::Server->new_from_config($config);        
 
     return Apache2::Const::OK;
 }
 
-sub AUTOLOAD {
+
+sub AUTOLOAD
+{
     my $self = shift;
 
@@ -76,3 +82,4 @@
 }
 
+
 1;
