in reply to Re^14: How can i capture the site_id in Dancer 2 app?
in thread How can i capture the site_id in Dancer 2 app?
return html_page("Error: " . $access_token->to_string) if $access_token->{error};
You have not written a subroutine named html_page ... (you probably don't need one as you can use the Dancer2 page rendering or error page templates. But you cannot call a sub that does not exist in your code!)
Try printing out $access_token->{error} and see what the issue is.
The way forward always starts with a minimal test.
In Section
Seekers of Perl Wisdom