Adeola Awoyemi escribió:
Hi all,
Is there a way to do an internal redirect in Catalyst?
In my application I'm generating images on the fly and want to
redirect to the image if creation succeeds.
For instance:
$image = Imager->new()
$image->read( file => $src_file );
$new_img = $image->copy->scale( xpixels => 32, ypixels => 32 );
if ( $new_img->write( file => $new_filename ) ) {
# do internal redirect to new file here
}
I tried using "$c->response->redirect( $new_filepath )" but that
issues a 302 "Temporarily Moved" status. But what I actually want is a
way to do the redirect outside of the response chain.
I hope this is clear?!
Hi,
another option would be to store the generated files somewhere under the
control of the Static::Simple plugin, and then redirect the user there:
$c->res->redirect( $c->uri_for('/static/', 'path/to/my/file') );
See Catalyst::Plugin::Static::Simple documentation for details on how to
define what directories it takes care of.
--R
_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/