What are you trying to pass to api_func1? An anonymous function?
So did you mean api_func1(sub{…})
as opposed to
api_func1(sub =>{…}); # Extra => ?
> On 5 Apr 2016, at 16:39, Pavel Serikov <[email protected]> wrote:
>
> Thanks, Dominique, I was inattentive. But problem still not solved. Not I
> have an error
>
> Global symbol "$json" requires explicit package name
>
> at string marked yellow.
>
> api_func1(sub => {
> my ($self, $json) = @_;
> $c->render(json => $json);
> })
>
> What could be wrong?
>
> Also tried
>
> api_func1(sub => {
> my $json = shift;
> $c->render(json => $json);
> })
>
> But same error.
>
>
>
>
> вторник, 5 апреля 2016 г., 19:19:47 UTC+4 пользователь Dominique Dumont
> написал:
> On Tuesday 05 April 2016 08:14:36 Pavel Serikov wrote:
> > But I got a syntax error at string marked orange. What is wrong?
>
> $cb is a sub reference and must be called with '->':
>
> $cb->($tx->res->json);
>
> HTH
>
> --
> https://github.com/dod38fr/ <https://github.com/dod38fr/> -o-
> http://search.cpan.org/~ddumont/ <http://search.cpan.org/~ddumont/>
> http://ddumont.wordpress.com/ <http://ddumont.wordpress.com/> -o- irc: dod
> at irc.debian.org <http://irc.debian.org/>
>
> --
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/mojolicious
> <https://groups.google.com/group/mojolicious>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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.