Normalize newlines on end of JSON text, to handle whatever is wrong with JSON on CentOS 6.

This commit is contained in:
Daniel Nichter
2013-01-31 17:48:25 -07:00
parent 8bc6181809
commit 3b64102f17

View File

@@ -53,9 +53,14 @@ sub as_json {
$json->allow_blessed([]); $json->allow_blessed([]);
$json->convert_blessed([]); $json->convert_blessed([]);
return $json->encode( my $text = $json->encode(
ref $resource eq 'ARRAY' ? $resource : as_hashref($resource, %args) ref $resource eq 'ARRAY' ? $resource : as_hashref($resource, %args)
); );
if ( $args{json} && $text ) { # for testing
chomp($text);
$text .= "\n";
}
return $text;
} }
sub as_config { sub as_config {