Hi, I corrected it.
But, I am still getting the syntax error and the following log. use Mojo::Base 'Mojolicious::Controller', -async_await, -signatures; # This action will render a template async sub on_user_login_p ($self) { $self->render_later; # Authenticate by sending the request parameters directly if ($self->authenticate($self->param('username'), $self->param('password'))) { my $access_token = $self->access_token($self->session('refresh_token')); my $user = await $self->user_data_p($access_token); return $self->render(text => 'Unauthenticated Access', status => 403) unless ($user->{is_staff}); return $self->render(text => 'You are not an active User', status => 403) unless ($user->{is_active}); $self->set_authorization($user); $self->flash(message_type => 'success'); $self->flash(message => 'Congratulations ' . $self->session('full_name') . '!'); $self->redirect_to('bi-home'); } else { $self->flash(message_type => 'danger'); $self->flash(message => 'Wrong SSOID/Password!'); return $self->redirect_to('login', status => 403); #return $self->render(text => 'wrong ssoid/password', status => 403); } } async sub user_data_p ($c, $access_token) { my $ua = Mojo::UserAgent->new; my $tx = await $ua->post_p( 'http://' . $c->config->{API_IP} . '/api-converge/auth/user/', { Authorization => 'Bearer ' . $access_token, }, form => {username => $c->session('username')}, ); if ($tx->is_success) { return from_json($tx->result->body); } $c->render(text => 'User Data can not be obtained', status => 500); } [2020-05-26 23:53:56.00449] [-15696] [debug] GET "/" (e7a8d2e9) [2020-05-26 23:53:56.01464] [-15696] [error] syntax error at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 38, near "async sub on_user_login_p ($self) " Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 39. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 42. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 42. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 42. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 43. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 43. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 44. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 45. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 46. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 47. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 48. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 49. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 49. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 50. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 52. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 53. Global symbol "$self" requires explicit package name (did you forget to declare "my $self"?) at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 54. syntax error at C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm line 57, near "}" C:.../projects/perl_projects/mojo_projects/converge_at_commex/script/../lib/ConvergeAtCommex/Controller/Sessions.pm has too many errors. Compilation failed in require at (eval 659) line 1. [2020-05-26 23:53:56.01609] [-15696] [debug] Template "exception.development.html.ep" not found [2020-05-26 23:53:56.01711] [-15696] [debug] Template "exception.html.ep" not found [2020-05-26 23:53:56.01927] [-15696] [debug] Rendering template "mojo/debug.html.ep" [2020-05-26 23:53:56.08608] [-15696] [debug] 500 Internal Server Error (0.081533s, 12.265/s) [2020-05-26 23:53:57.75761] [-15696] [debug] GET "/" (a91d3077) [2020-05-26 23:53:57.75823] [-15696] [debug] Routing to controller "ConvergeAtCommex::Controller::Sessions" and action "is_authenticated" [2020-05-26 23:53:57.75904] [-15696] [debug] 302 Found (0.001412s, 708.215/s) [2020-05-26 23:53:57.76139] [-15696] [debug] Routing to controller "ConvergeAtCommex::Controller::BusinessIntelligence" and action "index" [2020-05-26 23:53:57.76250] [-15696] [debug] Rendering template "business_intelligence/index.html.ep" [2020-05-26 23:53:57.77103] [-15696] [debug] Rendering template "business_intelligence/_unapproved.html.ep" [2020-05-26 23:53:57.77651] [-15696] [debug] Rendering template "business_intelligence/_test.html.ep" [2020-05-26 23:53:57.78271] [-15696] [debug] Rendering template "layouts/_country_footer.html.ep" [2020-05-26 23:53:57.78699] [-15696] [debug] Rendering template "layouts/default.html.ep" [2020-05-26 23:53:57.79491] [-15696] [debug] Rendering template "layouts/_mojo_default.html.ep" [2020-05-26 23:53:57.80086] [-15696] [debug] Rendering template "layouts/_shim.html.ep" [2020-05-26 23:53:57.80362] [-15696] [debug] Rendering template "layouts/_site_header.html.ep" [2020-05-26 23:53:57.80667] [-15696] [debug] Rendering template "layouts/_right_navigation.html.ep" [2020-05-26 23:53:57.81295] [-15696] [debug] Rendering template "layouts/_site_footer.html.ep" [2020-05-26 23:53:57.83392] [-15696] [debug] GET "/login" (96b58437) [2020-05-26 23:53:57.83532] [-15696] [debug] Routing to controller "ConvergeAtCommex::Controller::Sessions" and action "login" [2020-05-26 23:53:57.83608] [-15696] [debug] Rendering template "sessions/login.html.ep" [2020-05-26 23:53:57.84332] [-15696] [debug] Rendering cached template "layouts/default.html.ep" [2020-05-26 23:53:57.84381] [-15696] [debug] Rendering cached template "layouts/_mojo_default.html.ep" [2020-05-26 23:53:57.84428] [-15696] [debug] Rendering cached template "layouts/_shim.html.ep" [2020-05-26 23:53:57.84484] [-15696] [debug] Rendering cached template "layouts/_site_header.html.ep" [2020-05-26 23:53:57.84502] [-15696] [debug] Rendering cached template "layouts/_right_navigation.html.ep" [2020-05-26 23:53:57.84611] [-15696] [debug] Rendering cached template "layouts/_site_footer.html.ep" [2020-05-26 23:53:57.84689] [-15696] [debug] 200 OK (0.012977s, 77.059/s) [2020-05-26 23:54:00.80700] [-15696] [debug] GET "/login" (f5c021e3) [2020-05-26 23:54:00.80737] [-15696] [debug] Routing to controller "ConvergeAtCommex::Controller::Sessions" and action "login" [2020-05-26 23:54:00.80758] [-15696] [debug] Rendering cached template "sessions/login.html.ep" [2020-05-26 23:54:00.81043] [-15696] [debug] Rendering cached template "layouts/default.html.ep" [2020-05-26 23:54:00.81101] [-15696] [debug] Rendering cached template "layouts/_mojo_default.html.ep" [2020-05-26 23:54:00.81149] [-15696] [debug] Rendering cached template "layouts/_shim.html.ep" [2020-05-26 23:54:00.81253] [-15696] [debug] Rendering cached template "layouts/_site_header.html.ep" [2020-05-26 23:54:00.81346] [-15696] [debug] Rendering cached template "layouts/_right_navigation.html.ep" [2020-05-26 23:54:00.81655] [-15696] [debug] Rendering cached template "layouts/_site_footer.html.ep" [2020-05-26 23:54:00.81950] [-15696] [debug] 200 OK (0.012424s, 80.489/s) [2020-05-26 23:54:23.71050] [-15696] [debug] POST "/login" (05c91967) [2020-05-26 23:54:23.71154] [-15696] [debug] Routing to controller "ConvergeAtCommex::Controller::Sessions" and action "on_user_login_p" [2020-05-26 23:54:23.71169] [-15696] [debug] Action not found in controller [2020-05-26 23:54:23.71255] [-15696] [debug] Template "sessions/on_user_login_p.html.ep" not found [2020-05-26 23:54:23.71347] [-15696] [debug] Template "not_found.development.html.ep" not found [2020-05-26 23:54:23.71433] [-15696] [debug] Template "not_found.html.ep" not found [2020-05-26 23:54:23.71480] [-15696] [debug] Rendering cached template "mojo/debug.html.ep" [2020-05-26 23:54:23.73582] [-15696] [debug] 404 Not Found (0.025269s, 39.574/s) On Tuesday, 26 May 2020 23:42:47 UTC+5:30, Dan Book wrote: > > On Tue, May 26, 2020 at 2:06 PM Jeyaraj Durairaj <jeyaraj...@gmail.com > <javascript:>> wrote: > >> async on_user_login_p => sub { >> >> async sub user_data_p () { >> > > These two declarations are not quite right in different ways. The first > one is giving you a syntax error because it isn't any supported syntax. > Just do "async sub foo {" > > -Dan > -- 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 mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/21827d97-a6bd-4ad2-bb9a-7a84dcde9bd4%40googlegroups.com.