Consul-Simple

 view release on metacpan or  search on metacpan

lib/Consul/Simple.pm  view on Meta::CPAN

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    my $content = $res->content;
    my $values = JSON::decode_json($content);
    @entries = @$values;
};
my @ret = ();
foreach my $entry (@entries) {
    #The returned entry Value is always base64 encoded
    $entry->{Value} = MIME::Base64::decode_base64($entry->{Value});
 
    #the idea below is to try to JSON decode it.  If that works,
    #return the JSON decoded value.  Otherwise, return it un-decoded
    my $value;
    eval {
        $value = JSON::decode_json($entry->{Value});
    };
    $value = $entry->{Value} unless $value;
    $entry->{Value} = $value;
    push @ret, $entry;
}
 
return @ret;



( run in 0.267 second using v1.01-cache-2.11-cpan-c6e0e5ac2a7 )