From 1c54c8b4b9091cabeacaa663c64deb3c6e8d72eb Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 23 Mar 2009 11:44:25 +0000 Subject: [PATCH] info git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@51 447b33ff-793d-4489-8442-9bea7d161be5 --- lib/Redis.pm | 19 +++++++++++++++++++ t/01-Redis.t | 9 ++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/Redis.pm b/lib/Redis.pm index 7d2e692..29c2746 100644 --- a/lib/Redis.pm +++ b/lib/Redis.pm @@ -595,6 +595,25 @@ sub shutdown { $self->_sock_send( 'SHUTDOWN' ); } +=head1 Remote server control commands + +=head2 info + + my $info_hash = $r->info; + +=cut + +sub info { + my $self = shift; + my $info = $self->_sock_result_bulk( 'INFO' ); + my $hash; + foreach my $l ( split(/\r\n/, $info ) ) { + my ($n,$v) = split(/:/, $l, 2); + $hash->{$n} = $v; + } + return $hash; +} + =head1 AUTHOR Dobrica Pavlinusic, C<< >> diff --git a/t/01-Redis.t b/t/01-Redis.t index 7a990ce..211f743 100755 --- a/t/01-Redis.t +++ b/t/01-Redis.t @@ -4,6 +4,7 @@ use warnings; use strict; use Test::More tests => 106; +use Data::Dump qw/dump/; use lib 'lib'; @@ -176,7 +177,13 @@ diag "Persistence control commands"; ok( $o->save, 'save' ); ok( $o->bgsave, 'bgsave' ); ok( $o->lastsave, 'lastsave' ); -ok( $o->shutdown, 'shutdown' ); +#ok( $o->shutdown, 'shutdown' ); +diag "shutdown not tested"; + +diag "Remote server control commands"; + +ok( my $info = $o->info, 'info' ); +diag dump( $info ); diag "Connection handling"; -- 2.20.1