Catalyst::Plugin::BuildURI - Build URI by action name, namespace, and args
package MyApp; use Catalyst qw/BuildURI/; MyApp->config( name => 'MyApp', build_uri => { 'app' => 'http://app.art-code.org/', 'img' => 'http://img.art-code.org/' } ); ... package MyApp::Controller::Foo::Bar sub redirect_target: Regex('^target/(\d{4})/(\d{2})$') { my ($self, $c) = @_; # some code } sub redirect_action: Local { my ($self, $c) = @_; # redirect to "http://www.art-code.org/target/2006/10/?id=zigorou&password=hogehoge" $c->response->redirect($c->build_uri('foo/bar', 'redirect_target', [2006, 10], {id => 'zigorou', password => 'hogehoge'}, 'http://www.art-code.org/')); } sub labeled_redirect_action: Local { my ($self, $c) = @_; # redirect to "http://app.art-code.org/target/1976/12/?id=zigorou&password=hogehoge" $c->response->redirect($c->build_uri_by_label('foo/bar', 'labeled_redirect_action', [1976, 12], 'id=zigorou&password=hogehoge', 'app')); } ... [%# in template %] <a href="[% $c.build_uri('foo/bar', 'redirect_target', [2006, 10], {id => 'zigorou', password => 'hogehoge'}, 'http://www.art-code.org/') %]" title="test">redirect to</a>
This module is building uri string from namespace, action name, args or other.
Build URI using namespace, action name, args. optional parameter is base_uri. default is $c->request->uri->as_string;
Build URI by labeled base_uri. Please setting labeled base_uri to config of your application.
Catalyst. URI.
Toru Yamaguchi <zigorou@cpan.org>
<zigorou@cpan.org>
Copyright (c) 2006, Toru Yamaguchi <zigorou@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Catalyst::Plugin::BuildURI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::BuildURI
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::BuildURI
For more information on module installation, please visit the detailed CPAN module installation guide.