Consul-Simple
view release on metacpan or search on metacpan
lib/Consul/Simple.pm view on Meta::CPAN
979899100101102103104105106107108109110111112113114115116117
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 )