I have a main function called make_file() that gets all the IDs and Associated filenames into an hash array ($href_data). This hash is getting passed into another function make_file() where an object 'hr_data_file' (in blue text below) is getting created. All I am trying to do is to call this object 'hr_data_file' into get_leaves() function and print the associated IDs and Names and other fields.
I seek for help and advice on how to print the fields form this object into the get_leaves() function. Please see the Text in red below where I am trying to print the values from the 'hr_data_file'. I tried some suggestions made in this forum on priting Hash arrays but did not seems to work, probably I am doing something wrong.
Will really appreciate any advice on this.
#!/usr/bin/perl
.....Some code..........
.........................
$href_data = make_file();
$aref_all_groups = make_groups($links,0,$max_links, $href_data);
sub make_file
{
...................................................
...........................................
while ( $hash_refrence = $std->fetchrow_hashref )
{
push @{$file_return->{$hash_refrence->{'ID'}}}, $hash_reference;
$node_index++;
}
return (file_return);
}
sub make_groups
{
($aref_links, $curr_link_counter, $max_link, $href_data ) = @_;
.......Some code comes here.......
if ( $curr_child_type_cde eq 'F')
{
$href_child=
{
'group_name' => $curr_group_name,
'group_id' => $curr_child_file_id,
'group_type' => $curr_group_type,
'hr_data_file' => $href_data->{$curr_child_file_id} ---->object is getting created.
};
# print "The hr_data_file is: ",Dumper($href_data->{$curr_child_file_id}),"\n";
$$ar_child_files[$child_file_counter++]=$href_child;
return($aref_groups);
}
sub get_leaves
{
....Some code.........
.........................
($G1, $a_files, $level) = @_;
$ar_files=$G1->{'ar_child_files'};
for $F1 ( @$ar_files )
{
print $F1->{'hr_data_file'}{'FL_NM'}; ---->How to grab the values from the Object hr_data_file.
print "SpSheet.ActiveSheet.Cells($cols[$PREFIX_DESC], $PREFIX_DESC).Value = \"$F1->{'hr_data_file'}{'FL_DSC'}\"\n";
$cols[$PREFIX_DESC]++;
}
}
I seek for help and advice on how to print the fields form this object into the get_leaves() function. Please see the Text in red below where I am trying to print the values from the 'hr_data_file'. I tried some suggestions made in this forum on priting Hash arrays but did not seems to work, probably I am doing something wrong.
Will really appreciate any advice on this.
#!/usr/bin/perl
.....Some code..........
.........................
$href_data = make_file();
$aref_all_groups = make_groups($links,0,$max_links, $href_data);
sub make_file
{
...................................................
...........................................
while ( $hash_refrence = $std->fetchrow_hashref )
{
push @{$file_return->{$hash_refrence->{'ID'}}}, $hash_reference;
$node_index++;
}
return (file_return);
}
sub make_groups
{
($aref_links, $curr_link_counter, $max_link, $href_data ) = @_;
.......Some code comes here.......
if ( $curr_child_type_cde eq 'F')
{
$href_child=
{
'group_name' => $curr_group_name,
'group_id' => $curr_child_file_id,
'group_type' => $curr_group_type,
'hr_data_file' => $href_data->{$curr_child_file_id} ---->object is getting created.
};
# print "The hr_data_file is: ",Dumper($href_data->{$curr_child_file_id}),"\n";
$$ar_child_files[$child_file_counter++]=$href_child;
return($aref_groups);
}
sub get_leaves
{
....Some code.........
.........................
($G1, $a_files, $level) = @_;
$ar_files=$G1->{'ar_child_files'};
for $F1 ( @$ar_files )
{
print $F1->{'hr_data_file'}{'FL_NM'}; ---->How to grab the values from the Object hr_data_file.
print "SpSheet.ActiveSheet.Cells($cols[$PREFIX_DESC], $PREFIX_DESC).Value = \"$F1->{'hr_data_file'}{'FL_DSC'}\"\n";
$cols[$PREFIX_DESC]++;
}
}