my ( $self, $k ) = @_;
print $sock "GET $k\r\n";
my $len = <$sock>;
+# warn "# len: ",dump($len);
+ return undef if $len eq "nil\r\n";
my $v;
read($sock, $v, $len) || die $!;
+# warn "# v: ",dump($v);
+ my $crlf;
+ read($sock, $crlf, 2); # skip cr/lf
return $v;
}
+
+
=head1 AUTHOR
Dobrica Pavlinusic, C<< <dpavlin at rot13.org> >>
use warnings;
use strict;
-use Test::More tests => 6;
+use Test::More tests => 93;
use lib 'lib';
ok( $o->set( foo => 'bar' ), 'set foo' );
cmp_ok( $o->get( 'foo' ), 'eq', 'bar', 'get foo' );
+ok( ! $o->get( 'non-existant' ), 'get non-existant' );
+
+foreach ( 0 .. 42 ) {
+ ok( $o->set( "key-$_" => $_ ), "set key-$_" );
+ cmp_ok( $o->get( "key-$_" ), 'eq', $_, "get key-$_" );
+}
+
ok( $o->quit, 'quit' );