Hi,
I'm working on code that I inherited, and I've hit something that is opaque to me.
What does this code snip in setup() intend to do, specifically regarding the hash key 'cb'?
my $authed = $r->under("/$path_base")->to(cb => sub {
my $c = shift;
return $c->deny_auth unless $c->auth && $c->authz(role => 'update');
return 1;
})->name("authed_select_$name");
$authed->post->to("$cname#create")->name("create_$name");
The
documentation on to() doesn't seem to help here.
I see some references to a $cb value in the bowels of the mojilicious code base, so I'm guessing it's reaching inside to affect behavour somewhere; furthermore, I don't see the hash key cb being used anywhere in the code; only being set during the app setup().
The full code context is at
https://github.com/USGCRP/gcis/blob/master/lib/Tuba.pm#L259 , if that's helpful.
Thanks in advance for any insights,
-Randall