Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

$C -> uri_for containing current path in catalyst 5.90010

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


stevep at majestic12

Mar 8, 2012, 11:05 AM

Post #1 of 3 (351 views)
Permalink
$C -> uri_for containing current path in catalyst 5.90010

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


davewood at gmx

Mar 8, 2012, 11:49 AM

Post #2 of 3 (330 views)
Permalink
Re: $C -> uri_for containing current path in catalyst 5.90010 [In reply to]

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> 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
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


davewood at gmx

Mar 8, 2012, 11:50 AM

Post #3 of 3 (332 views)
Permalink
Re: $C -> uri_for containing current path in catalyst 5.90010 [In reply to]

forgot to include my catalyst version

[info] Foo powered by Catalyst 5.90010

On 8 March 2012 20:49, David Schmidt <davewood [at] gmx> 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> 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
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
>> Dev site: http://dev.catalyst.perl.org/
>>

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.