Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings raised on getting value for undefined key #1

Open
dionys opened this issue Dec 25, 2013 · 0 comments
Open

Warnings raised on getting value for undefined key #1

dionys opened this issue Dec 25, 2013 · 0 comments

Comments

@dionys
Copy link

dionys commented Dec 25, 2013

Call of $memd->get(undef, cb => sub { my ($val, $err) = @_; ... }) raises Use of uninitialized value within @_ in list assignment warning.

I'm not shure that it is an error. But…

The reason for this is that if $key is undef in _get() method then $args{cb}( $array ? \%res : $res{ $keys } ); calls with one undefined argument (not undef value).

So may be you wouldn't send request to the server if key isn't defined. Like this:

sub _get {
    my $self = shift;
    my $cmd  = shift;
    my $keys = shift;
    my %args = @_;

    unless (defined($keys)) {
        $_ and $_->begin() for $self->{cv}, $args{cv};
        $args{cb}(undef);
        $_ and $_->end() for $self->{cv}, $args{cv};
        return;
    }
    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant