> You asked 3 different questions which are hard to follow without any code
example.
Ok. I'll give examples
> 2) I'm preparing my layout data before the data in the controller (in
before_dispatch hook).
> $self->app->hook(before_dispatch => sub {
> my $c = shift;
> MyApp::Layout::prepare_first($c);
> MyApp::Layout::prepare_second($c);
>
> # I should execute this code not in "before_dispatch"
> # But Mojolicious does not have a hook, which executes right
> # after action in controllers. Right now I can execute this code only
> in template. But it sucks
> MyApp::Layout::prepare_third($c);
> });
> 1) I have some code in before_dispatch hook which should be executed
only for HTML requests. Not for JSON (or even static files).
Almost the same code
> $self->app->hook(before_dispatch => sub {
> my $c = shift;
> # TODO: I should execute this code only for HTML requests. Not for
> JSON/XML/Static
> # TODO: I don't want to put these two lines into each my controller
> action
> MyApp::Layout::prepare_first($c);
> MyApp::Layout::prepare_second($c);
> });
--
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.