Skip Menu |
 

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 2603
Status: rejected
Priority: 0/
Queue: CGI-Session

People
Owner: sherzodr [...] cpan.org
Requestors: makoto [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: please add method : redirect
Download (untitled) / with headers
text/plain 366b
sub redirect { my $session = shift; my($url,$param) = split(/\?/,shift); my %param = map {split /=/,$_,2} split /&/ ,$param; unless(exists $param{$session->name}){ $param{$session->name} = $session->id; } my $r = $url; my $r_param = join "&",map {"$_=$param{$_}"} keys %param; $r = "$r?$r_param" if($r_param); return CGI->redirect(-uri => $r , @_); }
From: mark [...] summersault.com
Download (untitled) / with headers
text/plain 501b
Here's a simplication of this patch: sub redirect { my $session = shift; my($url,$param) = split(/\?/,shift); my $q = new CGI ($param); $q->param($session->name,$session->id); return $q->redirect(-uri => "$url?".$q->query_string); } It makes use CGI.pm's built-in functions to manage query string parameters. Neither patch allows you to pass other headers when you redirect, which is sometimes useful. Of course, CGI.pm's redirect could always be used directly for that.
Download (untitled) / with headers
text/plain 821b
[MARKSTOS - Tue Jul 15 12:10:55 2003]: Show quoted text
> Here's a simplication of this patch: > > sub redirect { > my $session = shift; > my($url,$param) = split(/\?/,shift); > my $q = new CGI ($param); > $q->param($session->name,$session->id); > return $q->redirect(-uri => "$url?".$q->query_string); > } > > It makes use CGI.pm's built-in functions to manage query string > parameters. Neither > patch allows you to pass other headers when you redirect, which is > sometimes useful. > Of course, CGI.pm's redirect could always be used directly for that. >
Ah, the original patch /did/ support passing through additional parameters. That just wasn't clear to me at first. The last line of my simplification needs to be updated to support that: return $q->redirect(-uri => "$url?".$q->query_string, @_);
Date: Tue, 15 Jul 2003 11:32:41 -0600 (MDT)
From: Sherzod Ruzmetov <sherzodr [...] handalak.com>
To: via RT <bug-CGI-Session [...] rt.cpan.org>
Subject: Re: [cpan #2603] please add method : redirect
RT-Send-Cc:
Download (untitled) / with headers
text/plain 674b
:sub redirect { : my $session = shift; : my($url,$param) = split(/\?/,shift); : my $q = new CGI ($param); : $q->param($session->name,$session->id); : return $q->redirect(-uri => "$url?".$q->query_string); :} :It makes use CGI.pm's built-in functions to manage query string parameters. Neither :patch allows you to pass other headers when you redirect, which is sometimes useful. :Of course, CGI.pm's redirect could always be used directly for that. Thanks for the patch. I'll make sure to provide redirect() and other utility methods in the next release. -- Sherzod B. Ruzmetov <sherzodr@handalak.com> <URL: http://author.handalak.com >
Download (untitled) / with headers
text/plain 651b
I know I helped with this patch, but I've changed my mind about the appropriateness of having this in the core of CGI::Session. CGI::Session has already become a large package and a redirect() function is not central to session management. I suggest instead releasing this as CGI::Session::Plugin::Redirect, using a mix-in pattern to make this appear as an additional CGI::Session method. That way, you can have the extra method you want, and be responsible for any future maintenance of it as well. :) Sherzod may disagree with me about this re-open the ticket, but I'm marking it 'rejected' it for now. Mark


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.