Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: raw_query_string() #161

Closed
epa opened this issue Dec 15, 2014 · 6 comments
Closed

Feature: raw_query_string() #161

epa opened this issue Dec 15, 2014 · 6 comments

Comments

@epa
Copy link

epa commented Dec 15, 2014

While query_string() provides the current object state as an encoded string, sometimes you want access to the raw query string sent by the user. It would be useful to have a raw_query_string() function giving this. It would return $ENV{QUERY_STRING} but I think it is cleaner to have CGI.pm provide a function for this rather than user code poking around in the env vars directly.

@leejo
Copy link
Owner

leejo commented Dec 15, 2014

Sounds useful - think you could have a crack at a pull request?

@epa
Copy link
Author

epa commented Dec 15, 2014

Yes tomorrow I will make a pull request.


This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com


@epa
Copy link
Author

epa commented Dec 15, 2014

What should happen with explicit creation of a CGI object?

 new CGI('foo=bar')

Should raw_query_string return what was passed? Or always follow the env var?

@leejo
Copy link
Owner

leejo commented Dec 15, 2014

Good question. I think whatever the current object thinks is the current query string is the sensible thing to return. The code already has some checking at object instantiation so most of the logic is probably already there for returning the most recent (correct) query string.

@epa
Copy link
Author

epa commented Dec 16, 2014

That said, look at url_param(). It always returns the parameters in QUERY_STRING, ignoring any parameter string passed at CGI object construction and ignoring any parameter changes set since. So I think this is precedent that raw_query_string() can also just use QUERY_STRING.

@epa
Copy link
Author

epa commented Mar 1, 2015

Thanks for adding this. Sorry my patch got bogged down in the issue of new CGI('foo=bar'). I think your simple approach is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants