3 ways for a better readable dump
(Footnote: since "fields" belongs to an errors array you should rather loop over all possible errors)
use strict;
use warnings;
# some unreadable Data in a single line
my $VAR1 = { 'cookies' => { '_AVESTA_ENVIRONMENT' => 'prod', '_mcid' =
+> '1.340667ccb3eb6552450356561ab6bd92.4410ca7570d70e1141356a24d924a2a
+789d1bea2b8a417b761406f755ab1d9ba' }, 'error' => '400 Bad Request', '
+content' => { 'detail' => 'The resource submitted could not be valida
+ted. For field-specific details, see the \'errors\' array.', 'errors'
+ => [ { 'message' => 'This value should be of type object.', 'field'
+=> 'merge_fields' } ], 'status' => 400, 'title' => 'Invalid Resource'
+, 'type' => 'http://developer.mailchimp.com/documentation/mailchimp/g
+uides/error-glossary/', 'instance' => '59edf1fc-ed93-4a40-ba23-1f0af2
+4a6eb3' }, 'raw' => '{"type":"http://developer.mailchimp.com/document
+ation/mailchimp/guides/error-glossary/","title":"Invalid Resource","s
+tatus":400,"detail":"The resource submitted could not be validated. F
+or field-specific details, see the \'errors\' array.","instance":"59e
+df1fc-ed93-4a40-ba23-1f0af24a6eb3","errors":[{"field":"merge_fields",
+"message":"This value should be of type object."}]}', 'code' => '400'
+, 'header' => { 'Server' => 'openresty', 'Client-SSL-Cipher' => 'ECDH
+E-RSA-AES256-GCM-SHA384', 'Client-Date' => 'Mon, 27 Jan 2020 18:37:43
+ GMT', 'Date' => 'Mon, 27 Jan 2020 18:37:43 GMT', 'Client-SSL-Cert-Is
+suer' => '/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=GeoTrust RSA CA
+ 2018', 'Connection' => 'close', 'Client-Peer' => '23.55.203.69:443',
+ 'Content-Length' => '373', 'Client-SSL-Socket-Class' => 'IO::Socket:
+:SSL', 'Content-Type' => 'application/problem+json; charset=utf-8', '
+X-Request-Id' => '59edf1fc-ed93-4a40-ba23-1f0af24a6eb3', 'Set-Cookie'
+ => '_AVESTA_ENVIRONMENT=prod; path=/, _mcid=1.340667ccb3eb6552450356
+561ab6bd92.4410ca7570d70e1141356a24d924a2a789d1bea2b8a417b761406f755a
+b1d9ba; expires=Tue, 26-Jan-2021 18:37:42 GMT; Max-Age=31536000; path
+=/; domain=.mailchimp.com', 'Client-SSL-Cert-Subject' => '/C=US/ST=Ge
+orgia/L=Atlanta/O=The Rocket Science Group, LLC/OU=IT/CN=*.api.mailch
+imp.com', 'Link' => '; rel="describedBy"', 'Client-Response-Num' => 1
+ } };
warn "status: ", $VAR1->{content}{status};
warn "field: ", $VAR1->{content}{errors}[0]{field};
warn "********** Data::Dumper (core)";
use Data::Dumper;
warn Dumper $VAR1;
warn "********** Data::Dump";
use Data::Dump qw/pp dd/;
pp $VAR1;
warn "********** Data::Printer";
use Data::Printer;
p $VAR1;
status: 400 at c:/tmp/t_data_printer.pl line 9.
field: merge_fields at c:/tmp/t_data_printer.pl line 10.
********** Data::Dumper (core) at c:/tmp/t_data_printer.pl line 12.
$VAR1 = {
'error' => '400 Bad Request',
'cookies' => {
'_AVESTA_ENVIRONMENT' => 'prod',
'_mcid' => '1.340667ccb3eb6552450356561ab6bd9
+2.4410ca7570d70e1141356a24d924a2a789d1bea2b8a417b761406f755ab1d9ba'
},
'code' => '400',
'content' => {
'errors' => [
{
'field' => 'merge_fields',
'message' => 'This value shou
+ld be of type object.'
}
],
'instance' => '59edf1fc-ed93-4a40-ba23-1f0af2
+4a6eb3',
'status' => 400,
'type' => 'http://developer.mailchimp.com/doc
+umentation/mailchimp/guides/error-glossary/',
'title' => 'Invalid Resource',
'detail' => 'The resource submitted could not
+ be validated. For field-specific details, see the \'errors\' array.'
},
'header' => {
'Content-Type' => 'application/problem+json; c
+harset=utf-8',
'Client-Date' => 'Mon, 27 Jan 2020 18:37:43 GM
+T',
'Client-SSL-Cert-Issuer' => '/C=US/O=DigiCert
+Inc/OU=www.digicert.com/CN=GeoTrust RSA CA 2018',
'Client-Peer' => '23.55.203.69:443',
'Content-Length' => '373',
'Connection' => 'close',
'Client-Response-Num' => 1,
'Link' => '; rel="describedBy"',
'Client-SSL-Socket-Class' => 'IO::Socket::SSL'
+,
'Server' => 'openresty',
'Set-Cookie' => '_AVESTA_ENVIRONMENT=prod; pat
+h=/, _mcid=1.340667ccb3eb6552450356561ab6bd92.4410ca7570d70e1141356a2
+4d924a2a789d1bea2b8a417b761406f755ab1d9ba; expires=Tue, 26-Jan-2021 1
+8:37:42 GMT; Max-Age=31536000; path=/; domain=.mailchimp.com',
'X-Request-Id' => '59edf1fc-ed93-4a40-ba23-1f0
+af24a6eb3',
'Client-SSL-Cipher' => 'ECDHE-RSA-AES256-GCM-S
+HA384',
'Date' => 'Mon, 27 Jan 2020 18:37:43 GMT',
'Client-SSL-Cert-Subject' => '/C=US/ST=Georgia
+/L=Atlanta/O=The Rocket Science Group, LLC/OU=IT/CN=*.api.mailchimp.c
+om'
},
'raw' => '{"type":"http://developer.mailchimp.com/documentat
+ion/mailchimp/guides/error-glossary/","title":"Invalid Resource","sta
+tus":400,"detail":"The resource submitted could not be validated. For
+ field-specific details, see the \'errors\' array.","instance":"59edf
+1fc-ed93-4a40-ba23-1f0af24a6eb3","errors":[{"field":"merge_fields","m
+essage":"This value should be of type object."}]}'
};
********** Data::Dump at c:/tmp/t_data_printer.pl line 16.
{
code => 400,
content => {
detail => "The resource submitted could not be valida
+ted. For field-specific details, see the 'errors' array.",
errors => [
{
field => "merge_fields",
message => "This value should be of typ
+e object.",
},
],
instance => "59edf1fc-ed93-4a40-ba23-1f0af24a6eb3",
status => 400,
title => "Invalid Resource",
type => "http://developer.mailchimp.com/documentati
+on/mailchimp/guides/error-glossary/",
},
cookies => {
_AVESTA_ENVIRONMENT => "prod",
_mcid => "1.340667ccb3eb6552450356561ab6bd92.4410ca7570
+d70e1141356a24d924a2a789d1bea2b8a417b761406f755ab1d9ba",
},
error => "400 Bad Request",
header => {
"Client-Date" => "Mon, 27 Jan 2020 18:37:43 GMT",
"Client-Peer" => "23.55.203.69:443",
"Client-Response-Num" => 1,
"Client-SSL-Cert-Issuer" => "/C=US/O=DigiCert Inc/OU=ww
+w.digicert.com/CN=GeoTrust RSA CA 2018",
"Client-SSL-Cert-Subject" => "/C=US/ST=Georgia/L=Atlant
+a/O=The Rocket Science Group, LLC/OU=IT/CN=*.api.mailchimp.com",
"Client-SSL-Cipher" => "ECDHE-RSA-AES256-GCM-SHA384",
"Client-SSL-Socket-Class" => "IO::Socket::SSL",
"Connection" => "close",
"Content-Length" => 373,
"Content-Type" => "application/problem+json; charset=ut
+f-8",
"Date" => "Mon, 27 Jan 2020 18:37:43 GMT",
"Link" => "; rel=\"describedBy\"",
"Server" => "openresty",
"Set-Cookie" => "_AVESTA_ENVIRONMENT=prod; path=/, _mci
+d=1.340667ccb3eb6552450356561ab6bd92.4410ca7570d70e1141356a24d924a2a7
+89d1bea2b8a417b761406f755ab1d9ba; expires=Tue, 26-Jan-2021 18:37:42 G
+MT; Max-Age=31536000; path=/; domain=.mailchimp.com",
"X-Request-Id" => "59edf1fc-ed93-4a40-ba23-1f0af24a6eb3
+",
},
raw => "{\"type\":\"http://developer.mailchimp.com/documentation
+/mailchimp/guides/error-glossary/\",\"title\":\"Invalid Resource\",\"
+status\":400,\"detail\":\"The resource submitted could not be validat
+ed. For field-specific details, see the 'errors' array.\",\"instance\
+":\"59edf1fc-ed93-4a40-ba23-1f0af24a6eb3\",\"errors\":[{\"field\":\"m
+erge_fields\",\"message\":\"This value should be of type object.\"}]}
+",
}
********** Data::Printer at c:/tmp/t_data_printer.pl line 20.
\ {
code 400,
content {
detail "The resource submitted could not be validated. For
+ field-specific details, see the 'errors' array.",
errors [
[0] {
field "merge_fields",
message "This value should be of type object."
}
],
instance "59edf1fc-ed93-4a40-ba23-1f0af24a6eb3",
status 400,
title "Invalid Resource",
type "http://developer.mailchimp.com/documentation/mailc
+himp/guides/error-glossary/"
},
cookies {
_AVESTA_ENVIRONMENT "prod",
_mcid "1.340667ccb3eb6552450356561ab6bd92.4410
+ca7570d70e1141356a24d924a2a789d1bea2b8a417b761406f755ab1d9ba"
},
error "400 Bad Request",
header {
Client-Date "Mon, 27 Jan 2020 18:37:43 GMT",
Client-Peer "23.55.203.69:443",
Client-Response-Num 1,
Client-SSL-Cert-Issuer "/C=US/O=DigiCert Inc/OU=www.digicer
+t.com/CN=GeoTrust RSA CA 2018",
Client-SSL-Cert-Subject "/C=US/ST=Georgia/L=Atlanta/O=The Ro
+cket Science Group, LLC/OU=IT/CN=*.api.mailchimp.com",
Client-SSL-Cipher "ECDHE-RSA-AES256-GCM-SHA384",
Client-SSL-Socket-Class "IO::Socket::SSL",
Connection "close",
Content-Length 373,
Content-Type "application/problem+json; charset=u
+tf-8",
Date "Mon, 27 Jan 2020 18:37:43 GMT",
Link "; rel="describedBy"",
Server "openresty",
Set-Cookie "_AVESTA_ENVIRONMENT=prod; path=/, _
+mcid=1.340667ccb3eb6552450356561ab6bd92.4410ca7570d70e1141356a24d924a
+2a789d1bea2b8a417b761406f755ab1d9ba; expires=Tue, 26-Jan-2021 18:37:4
+2 GMT; Max-Age=31536000; path=/; domain=.mailchimp.com",
X-Request-Id "59edf1fc-ed93-4a40-ba23-1f0af24a6eb
+3"
},
raw "{"type":"http://developer.mailchimp.com/documentation/m
+ailchimp/guides/error-glossary/","title":"Invalid Resource","status":
+400,"detail":"The resource submitted could not be validated. For fiel
+d-specific details, see the 'errors' array.","instance":"59edf1fc-ed9
+3-4a40-ba23-1f0af24a6eb3","errors":[{"field":"merge_fields","message"
+:"This value should be of type object."}]}"
}
|