setDebugLevel
For procedural use.
Call as setDebugLevel($i);
A value of 0 disables debugging output (default)
walk
Walk the data structure and print the string required to access it
This can be used as an object or a procedure
As Procedure
use Data::Ref::JSON qw(walk);
my %tc = (
'HL01-01' => {
'HL02-01' => [
'element 0',
'element 1',
'element 2'
]
},
'HL01-02' => {
'HL02-01' => {
K4 => 'this is key 4',
K5 => 'this is key 5',
K6 => 'this is key 6'
}
}
);
walk(\%tc);
As Object
use Data::Ref::JSON;
my %tc = (
'HL01-01' => {
'HL02-01' => [
'element 0',
'element 1',
'element 2'
]
},
'HL01-02' => {
'HL02-01' => {
K4 => 'this is key 4',
K5 => 'this is key 5',
K6 => 'this is key 6'
}
}
);
my $dr = Data::Ref::JSON->new (
{
DEBUG => 0,
DATA => \%tc
}
);
$dr->walk;
new
Given an arbitrary data structure, create a new object that can then be traversed by walk().
walk() will print all values and the string used to access them
Given the following structure:
(
'HL01-01' => {
'HL02-01' => [
'element 0',
'element 1',
'element 2'
]
},
'HL01-02' => {
'HL02-01' => {
K4 => 'this is key 4',
K5 => 'this is key 5',
K6 => 'this is key 6'
}
}
);
This would be the output:
i:v, 0:element 0
refStr: VAR->{'HL01-01'}{'HL02-01'}[0]
i:v, 1:element 1
refStr: VAR->{'HL01-01'}{'HL02-01'}[1]
i:v, 2:element 2
refStr: VAR->{'HL01-01'}{'HL02-01'}[2]
k:v, 'K4':'this is key 4'
refStr: VAR->{'HL01-02'}{'HL02-01'}{'K4'}
k:v, 'K5':'this is key 5'
refStr: VAR->{'HL01-02'}{'HL02-01'}{'K5'}
k:v, 'K6':'this is key 6'
refStr: VAR->{'HL01-02'}{'HL02-01'}{'K6'}
Where
i = position in array
k = hash key
v = value
refStr = the string used to access the value
NAME
Data::Ref::JSON
SYNOPSIS
Walk a referenced arbitrary data structure and provide the reference to access values
DESCRIPTION
When working with deeply nested complex data structures, it can be quite difficult to determine just what the key is for any value.
Data::Ref::JSON will traverse the data, printing the values and the keys used to access them.
USAGE
See the examples for walk()
BUGS
SUPPORT
AUTHOR
Jared Still
CPAN ID: MODAUTHOR
Pythian
jkstill@gmail.com
http://a.galaxy.far.far.away/modules
COPYRIGHT
This program is free software licensed under the...
The MIT License
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
perl(1).