Index: /trunk/Nebulous-Server/t/18_client_open.t
===================================================================
--- /trunk/Nebulous-Server/t/18_client_open.t	(revision 4637)
+++ /trunk/Nebulous-Server/t/18_client_open.t	(revision 4638)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 18_client_open.t,v 1.2 2005-06-30 02:35:06 jhoblitt Exp $
+# $Id: 18_client_open.t,v 1.3 2005-07-28 03:48:41 jhoblitt Exp $
 
 use strict;
@@ -10,5 +10,5 @@
 use Apache::Test qw( -withtestmore );
 
-plan tests => 7;
+plan tests => 8;
 
 use lib qw( ./t ./lib );
@@ -68,4 +68,17 @@
 Test::Nebulous->setup;
 
+{
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+    $neb->replicate( "foo" );
+
+    is( $neb->open( "foo", 'write' ), undef,
+        "write to object with multiple instances" );
+}
+
+Test::Nebulous->setup;
+
 eval {
     my $neb = Nebulous::Client->new(
Index: /trunk/Nebulous/lib/Nebulous/Client.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Client.pm	(revision 4637)
+++ /trunk/Nebulous/lib/Nebulous/Client.pm	(revision 4638)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Client.pm,v 1.17 2005-07-28 01:40:26 jhoblitt Exp $
+# $Id: Client.pm,v 1.18 2005-07-28 03:48:41 jhoblitt Exp $
 
 package Nebulous::Client;
@@ -161,5 +161,5 @@
     }
 
-    my $fh  = $self->open( $key, 'write' );
+    my $fh  = $self->open( $key, 'read' );
     unless ( $fh ) {
         $log->debug( "can't open $key" );
@@ -435,4 +435,12 @@
 
     if ( $type eq 'write' ) {
+        my $num_instances = scalar @$locations;
+
+        if ( $num_instances > 1 ) {
+            $log->warn( "write not allowed with multiple instances" );
+            $log->debug( "leaving" );
+            return undef;
+        }
+
         eval {
             $fh = _get_filehandle( $path, '+<' );
Index: /trunk/Nebulous/t/18_client_open.t
===================================================================
--- /trunk/Nebulous/t/18_client_open.t	(revision 4637)
+++ /trunk/Nebulous/t/18_client_open.t	(revision 4638)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 18_client_open.t,v 1.2 2005-06-30 02:35:06 jhoblitt Exp $
+# $Id: 18_client_open.t,v 1.3 2005-07-28 03:48:41 jhoblitt Exp $
 
 use strict;
@@ -10,5 +10,5 @@
 use Apache::Test qw( -withtestmore );
 
-plan tests => 7;
+plan tests => 8;
 
 use lib qw( ./t ./lib );
@@ -68,4 +68,17 @@
 Test::Nebulous->setup;
 
+{
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+    $neb->replicate( "foo" );
+
+    is( $neb->open( "foo", 'write' ), undef,
+        "write to object with multiple instances" );
+}
+
+Test::Nebulous->setup;
+
 eval {
     my $neb = Nebulous::Client->new(
