Reputation: 587
For debugging purpose i have to print the below hash. can some one help me out in this as i am little new in complex data structure :
use strict;
use warnings;
my $issueMap;
$issueMap = {
'project' => SOAP::Data->type(string => "abc"),
'type' => SOAP::Data->type(string => "3"),
'summary' => SOAP::Data->type(string => $title), #issueDesc
'description' => SOAP::Data->type(string => $issueDesc),
'components' => [{'id' => SOAP::Data->type(string => $component_id)}],
'customFieldValues' => SOAP::Data->type('Array' => [
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10933'), values => [ SOAP::Data->type(string => $acbPath) ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10934'), values => [ SOAP::Data->type(string => $Path) ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10935'), values => [ SOAP::Data->type(string => $logPath) ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10071'), values => [ SOAP::Data->type(string => "PROD") ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10544'), values => [ SOAP::Data->type(string => $check_area) ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10842'), values => [ SOAP::Data->type(string => "Unavailable") ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_14927'), values => [ SOAP::Data->type(string => "Unavailable") ] },
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_14930'), values => [ SOAP::Data->type(string => $mcn) ] }, #MCN
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_14929'), values => [ SOAP::Data->type(string => $serialno) ] }, #SERIAL
{ 'customfieldId' => SOAP::Data->type(string => 'customfield_10060'), values => [ SOAP::Data->type(string => "$user_runner") ] } #user
])
};
Debug
foreach my $check (%{$issueMap})
{
print $issueMap ->$check."\n";
}
Error : Can't call method "customFieldValues" on unblessed reference during printing hash.
Upvotes: 0
Views: 594
Reputation: 954
I started to use DDP
(short for Data::Printer
) which gives a much cleaner, nice colourful and flexible output instead of tons of pages of lines that spawn across the screen two or three times.
use DDP;
p $issueMap;
have a look at Customization of Data::Printer for the many options, like expand
to make it go deeper into your structure.
Upvotes: 2