[Catalyst] $C -> uri_for containing current path in catalyst 5.90010

David Schmidt davewood at gmx.at
Thu Mar 8 19:50:14 GMT 2012


forgot to include my catalyst version

[info] Foo powered by Catalyst 5.90010

On 8 March 2012 20:49, David Schmidt <davewood at gmx.at> wrote:
> I tested your code
>
> sub exampleRedirect :Path(/oldPath) Args(0) {
>    my ( $self, $c ) = @_;
>    my %data = %{ $c->req->params };
>    my $url =  $c->uri_for( $self->action_for('newSub'), \%data );
>    $c->response->redirect( $url , 301 );
>    $c->log->debug('########: ' . $url);
> }
>
> sub newSub :Path(/this/someOtherPath) Args(0) {}
>
>
> [debug] Redirecting to "http://myapp.at:3000/this/someOtherPath?cheese=nice"
>
>
>
> On 8 March 2012 20:05,  <stevep at majestic12.co.uk> wrote:
>> Hi.
>>
>>
>>
>> We were trying to use catalyst 5.90010 to run a webapp, and almost
>> everything is totally lovely, apart from a few redirects.
>>
>>
>>
>> In version 5.90006 it all seems to be working well.
>>
>>
>>
>> The rewrite is along the lines of:
>>
>>
>>
>> sub exampleRedirect :Path( "/oldPath" ) Args(0)
>>
>> {
>>
>>     my ( $self, $c ) = @_;
>>
>>     my %data = %{ $c -> req -> params };
>>
>>     # … actions on %data removed
>>
>>     my $url =  $c -> uri_for( $c -> controller('This') ->
>> action_for('newSub'), \%data );
>>
>>     $c -> response -> redirect( $url , 301 ) ;
>>
>> }
>>
>>
>>
>> sub newSub :Path(“/this/someOtherPath”) Args(0)
>>
>> {
>>
>>                 …
>>
>> }
>>
>>
>>
>> When the server is called, on 5.90006, for
>> http://somedomain/oldPath?cheese=nice, $url becomes
>> http://somedomain/this/someOtherPath?cheese=nice
>>
>>
>>
>> On 5.9.0010, the same url becomes
>> http://somedomain/oldPath/this/someOtherPath?cheese=nice
>>
>>
>>
>> Obviously checked http headers and output $url above.
>>
>>
>>
>> Can anyone shed some light on this? It’s probably something stupid I’ve
>> done, as I cannot find much in google.
>>
>>
>>
>> Steve
>>
>>
>>
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>



More information about the Catalyst mailing list