Skip to content

Commit

Permalink
Merge pull request #78 from PerlRedis/ikruglov/77_new_server_empty
Browse files Browse the repository at this point in the history
Redis->new(server=>'') does not connect to localhost:6379 #77
  • Loading branch information
dams committed Feb 17, 2014
2 parents f2178db + 89cdaf0 commit 50a5eb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Redis.pm
Expand Up @@ -33,7 +33,7 @@ sub new {
$self->{debug} = $args{debug} || $ENV{REDIS_DEBUG};

## Deal with REDIS_SERVER ENV
if ($ENV{REDIS_SERVER} && !$args{sock} && !$args{server}) {
if ($ENV{REDIS_SERVER} && !$args{sock} && ! exists $args{server}) {
if ($ENV{REDIS_SERVER} =~ m!^/!) {
$args{sock} = $ENV{REDIS_SERVER};
}
Expand All @@ -60,7 +60,7 @@ sub new {
$self->{reconnect} = $args{reconnect} || 0;
$self->{every} = $args{every} || 1000;

if ($args{sock}) {
if (exists $args{sock}) {
$self->{server} = $args{sock};
$self->{builder} = sub {
my ($self) = @_;
Expand All @@ -84,7 +84,7 @@ sub new {
};
}
else {
$self->{server} = $args{server} || '127.0.0.1:6379';
$self->{server} = exists $args{server} ? $args{server} : '127.0.0.1:6379';
$self->{builder} = sub {
my ($self) = @_;
if (exists $self->{read_timeout} || exists $self->{write_timeout}) {
Expand Down

0 comments on commit 50a5eb4

Please sign in to comment.