This is a very bad approach. Check your app's log to see why. You
controller's method should depend only on the current route, not on
other controller
You need to move Items fetch logic from the controller to somewhere
else. Here is an example (I didn't run it, only an idea):
https://gist.github.com/alexbyk/6c5799ee904b03729c80
But dispatching the whole session to the other controller or to the
other app is a good way.
E.g I want to use json which is the result of rendering one route in
forming output of another route. To make code in my CRUD app less and
more reusable.
Something like this:
|
get'/api/:coll/:id'=>sub{
...
if($self->param("coll")eq "lists"){
...
push
@{$o->{items}},$self->ua->get('/api/items/'.$_->{item_id})->res->json;
...
|
Now I'm using Mojo::UserAgent
<https://metacpan.org/pod/Mojo::UserAgent> default helper
<http://mojolicio.us/perldoc/Mojolicious/Plugin/DefaultHelpers#ua> for
this. Is it a good way or is there any alternatives?
--
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 http://groups.google.com/group/mojolicious.
For more options, visit 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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.