Changeset 5662
- Timestamp:
- Dec 2, 2005, 4:26:59 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
Nebulous-Server/Changes (modified) (1 diff)
-
Nebulous-Server/t/11_client_create.t (modified) (5 diffs)
-
Nebulous-Server/t/11_client_open_create.t (added)
-
Nebulous/Changes (modified) (1 diff)
-
Nebulous/lib/Nebulous/Client.pm (modified) (4 diffs)
-
Nebulous/t/11_client_create.t (modified) (5 diffs)
-
Nebulous/t/11_client_open_create.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Changes
r5661 r5662 2 2 3 3 0.02 4 - add Nebulous::Client->open_create() 5 - change Nebulous::Client->create() to return just a filename 4 6 - [nebclient] add nebOpenCreate() 5 7 - [nebclient] change nebCreate() to return just a filename -
trunk/Nebulous-Server/t/11_client_create.t
r4440 r5662 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 11_client_create.t,v 1. 4 2005-06-30 02:35:06jhoblitt Exp $5 # $Id: 11_client_create.t,v 1.5 2005-12-03 02:26:59 jhoblitt Exp $ 6 6 7 7 use strict; … … 28 28 ); 29 29 30 my $f h= $neb->create( "foo" );30 my $filename = $neb->create( "foo" ); 31 31 32 is( ref $fh, 'GLOB', "good filehandle" );32 ok( -e $filename, "good filename" ); 33 33 } 34 34 … … 41 41 ); 42 42 43 my $f h= $neb->create( "foo", 0 );43 my $filename = $neb->create( "foo", 0 ); 44 44 45 is( ref $fh, 'GLOB', "good filehandle" );45 ok( -e $filename, "good filename" ); 46 46 } 47 47 … … 54 54 ); 55 55 56 my $f h= $neb->create( "foo", 0, "node01" );56 my $filename = $neb->create( "foo", 0, "node01" ); 57 57 58 is( ref $fh, 'GLOB', "good filehandle" );58 ok( -e $filename, "good filename" ); 59 59 } 60 60 … … 67 67 ); 68 68 69 my $f h= $neb->create( "foo", 0, "node01", "this is foo" );69 my $filename = $neb->create( "foo", 0, "node01", "this is foo" ); 70 70 71 is( ref $fh, 'GLOB', "good filehandle" );71 ok( -e $filename, "good filename" ); 72 72 } 73 73 -
trunk/Nebulous/Changes
r5661 r5662 2 2 3 3 0.02 4 - add Nebulous::Client->open_create() 5 - change Nebulous::Client->create() to return just a filename 4 6 - [nebclient] add nebOpenCreate() 5 7 - [nebclient] change nebCreate() to return just a filename -
trunk/Nebulous/lib/Nebulous/Client.pm
r4928 r5662 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1.2 0 2005-08-31 03:33:24jhoblitt Exp $3 # $Id: Client.pm,v 1.21 2005-12-03 02:26:59 jhoblitt Exp $ 4 4 5 5 package Nebulous::Client; … … 127 127 $log->debug( "server allocated $uri" ); 128 128 129 my $filename; 130 eval { 131 $filename = _get_file_path( $uri ); 132 }; 133 $log->logdie( $@ ) if $@; 134 135 $log->debug( "local filename is $filename" ); 136 137 $log->debug( "leaving" ); 138 139 return $filename; 140 } 141 142 sub open_create { 143 my $self = shift; 144 145 my ( $key, @params ) = validate_pos( @_, 146 { 147 type => SCALAR, 148 }, 149 { 150 type => SCALAR, 151 callbacks => { 152 'is + integer' => sub { $_[0] =~ /^\d+$/ }, 153 }, 154 default => 0, 155 }, 156 { 157 type => SCALAR, 158 optional => 1, 159 }, 160 { 161 type => SCALAR, 162 optional => 1, 163 }, 164 ); 165 166 $log->debug( "entered - @_" ); 167 168 # how should already existing files be handled? 169 170 my $response = $self->{ 'server' }->create_object( $key, @params ); 171 if ( $response->fault ) { 172 $log->error( $response->faultcode, " - ", $response->faultstring ); 173 $log->debug( "leaving" ); 174 175 return undef; 176 } 177 178 my $uri = $response->result; 179 180 $log->debug( "server allocated $uri" ); 181 129 182 my $fh; 130 183 eval { … … 497 550 ); 498 551 499 $log->debug( "entered - @_" );552 # $log->debug( "entered - @_" ); 500 553 501 554 my $fh = $self->open( $key, 'read' ); … … 507 560 } 508 561 509 my $new_fh = $self-> create( $new_key );562 my $new_fh = $self->open_create( $new_key ); 510 563 unless ( $new_fh ) { 511 564 $log->debug( "can not open object" ); -
trunk/Nebulous/t/11_client_create.t
r4440 r5662 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 11_client_create.t,v 1. 4 2005-06-30 02:35:06jhoblitt Exp $5 # $Id: 11_client_create.t,v 1.5 2005-12-03 02:26:59 jhoblitt Exp $ 6 6 7 7 use strict; … … 28 28 ); 29 29 30 my $f h= $neb->create( "foo" );30 my $filename = $neb->create( "foo" ); 31 31 32 is( ref $fh, 'GLOB', "good filehandle" );32 ok( -e $filename, "good filename" ); 33 33 } 34 34 … … 41 41 ); 42 42 43 my $f h= $neb->create( "foo", 0 );43 my $filename = $neb->create( "foo", 0 ); 44 44 45 is( ref $fh, 'GLOB', "good filehandle" );45 ok( -e $filename, "good filename" ); 46 46 } 47 47 … … 54 54 ); 55 55 56 my $f h= $neb->create( "foo", 0, "node01" );56 my $filename = $neb->create( "foo", 0, "node01" ); 57 57 58 is( ref $fh, 'GLOB', "good filehandle" );58 ok( -e $filename, "good filename" ); 59 59 } 60 60 … … 67 67 ); 68 68 69 my $f h= $neb->create( "foo", 0, "node01", "this is foo" );69 my $filename = $neb->create( "foo", 0, "node01", "this is foo" ); 70 70 71 is( ref $fh, 'GLOB', "good filehandle" );71 ok( -e $filename, "good filename" ); 72 72 } 73 73
Note:
See TracChangeset
for help on using the changeset viewer.
