On one of my pages, I'm trying to go grab the contents of another page from a different controller, and then take that HTML and use it to make a little "widget" on the first page.
If I was grabbing off the current page, I could just do:
my $html = $c->response->body();
But since it is in another controller, I can't figure out how to get it.
An additional (potential) complication is that the action in question needs an arg passed to it.
I tried my $html = $c->visit('/action/')->body();
- a shot in the dark - which I troubleshooted in another recent post. But that just seems to take over the current action, rather than allowing me to just grab the response from it.
The only thing I could think of (and this is untested) is storing the response of page 1, doing my $c->visit
, storing that response, then taking page 1's original response and outputting that right at the end. Seems overly convoluted, but that's the best I can think of.
Any ideas?