1
0
mirror of https://github.com/c-kr/check_json.git synced 2024-11-23 10:53:47 +01:00

Merge pull request #9 from Graham42/master

Fix for perl 5.8.8
This commit is contained in:
Christopher Kreft 2014-11-05 18:12:49 +01:00
commit b327672da1

View File

@ -158,7 +158,7 @@ my @statusmsg;
# routine to add perfdata from JSON response based on a loop of keys given in perfvals (csv) # routine to add perfdata from JSON response based on a loop of keys given in perfvals (csv)
if ($np->opts->perfvars) { if ($np->opts->perfvars) {
foreach my $key ($np->opts->perfvars eq '*' ? map { "{$_}"} sort keys $json_response : split(',', $np->opts->perfvars)) { foreach my $key ($np->opts->perfvars eq '*' ? map { "{$_}"} sort keys %$json_response : split(',', $np->opts->perfvars)) {
# use last element of key as label # use last element of key as label
my $label = (split('->', $key))[-1]; my $label = (split('->', $key))[-1];
# make label ascii compatible # make label ascii compatible
@ -188,7 +188,7 @@ if ($np->opts->perfvars) {
# output some vars in message # output some vars in message
if ($np->opts->outputvars) { if ($np->opts->outputvars) {
foreach my $key ($np->opts->outputvars eq '*' ? map { "{$_}"} sort keys $json_response : split(',', $np->opts->outputvars)) { foreach my $key ($np->opts->outputvars eq '*' ? map { "{$_}"} sort keys %$json_response : split(',', $np->opts->outputvars)) {
# use last element of key as label # use last element of key as label
my $label = (split('->', $key))[-1]; my $label = (split('->', $key))[-1];
# make label ascii compatible # make label ascii compatible