NAME
JMX::Jmx4Perl::Util - Utility methods for Jmx4Perl
DESCRIPTION
This class contains utility methods mostly for tools like jmx4perl or j4psh for things like formatting data output. All methods are 'static' methods which needs to be called like in
JMX::Jmx4Perl::Util->dump_value(...);
There is no constructor.
- $is_object = JMX::Jmx4Perl::Util->is_object_to_dump($val)
-
For dumping out, checks whether
$valis an object (i.e. it is a ref but not a JSON::XS::Boolean) or not. - $text = JMX::Jmx4Perl::Util->dump_value($value,{ format => "json", boolean_string =>1})
-
Return a formatted text representation useful for tools printing out complex response values. Two modes are available:
datawhich is the default and uses Data::Dumper for creating a textual description andjsonwhich return the result as JSON value. Whendatais used as format, booleans are returned as 0 for false and 1 for true exception when the optionboolean_stringis given in which case it returnstrueorfalse. - $dump = JMX::Jmx4Perl::Util->dump_scalar($val,$format)
-
Dumps a scalar value with special handling for booleans. If
$valis a JSON::XS::Boolean it is returned as string formatted according to$format.$formatmust contain two values separated bu/. The first part is taken for atruevalue, the second for afalsevalue. If no$formatis given,[true]/[false]is used.