hi,
when I issue a simple request like this:
my $login = $ua->post($url_com);
Checking the response is simple:
if ( my $res = $login->success ) {
....
}
else {
my $err = $login->error;
die "$err->{code} response: $err->{message}" if $err->{code};
}
But how to do it when using a more complex request and saving the json data
directly in the variable $sections (really cool that this is possible):
my $sections = $ua->get( "https://$url$api/sections/" => { 'token' =>
$token } )->res->json('/data');
if ( my $sections->success ) {
return $sections;
}
else {
my $err = $sections->error;
die "$err->{code} response: $err->{message}" if $err->{code};
}
I cannot use $sections->success :
Can't call method "success" on an undefined value at script.pl line ...
I am probably asking something very simple, my apologies for that, but the
answer escapes me so far.
Thanks in advance.
--
regards,
Natxo
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.