re[cgiapp] quest_method always returns GET. mor_rewrite problem

2009-02-02 Thread kropotkin

Hi

I have a run mode. I call it with a GET. It returns its output which is html
from a template. The template contains a form with the method attribute set
to POST like so: form action=/cart/register/ method=post name=main. 

But the ENV(REQUEST_METHOD) is set to GET when the form is POSTED. I think
this must be because I have a mod_rewrite rule which maps /cart/register to
/cart.cgi?rm=register. Does mod_rewite convert a POST to a GET request? How
could I avoid this?

Thanks

Justin
-- 
View this message in context: 
http://www.nabble.com/request_method-always-returns-GET.-mor_rewrite-problem-tp21792629p21792629.html
Sent from the cgiapp@lists.erlbaum.net mailing list archive at Nabble.com.


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




[cgiapp] Re: CAP::JSON and UTF8

2009-02-02 Thread Michael Peters

Mike Tonks wrote:

Hope it's ok to mail you directly. 


Yeah, that's fine, but I'm cc'ing the C::A list so that others can benefit from this discussion. 
Also, sorry for taking so long to get back to you on this.



I recently added your
CGI::Application::Plugin::JSON module to my project, and was very
pleased until I noticed my french language stuff with utf8 characters,
accents and so on, was mangled in the output.

I have temporarily abandonned the plugin and replaced the code as follows:

# send the JSON in the document body (removed)
#$self-json_body( $data );

# Signal to JSON::Any to use utf8
$ENV{JSON_ANY_CONFIG} = utf8=1;

my $j = JSON::Any-new;
my $json = $j-encode($data);

return $json;


Since CAP::JSON uses JSON::Any and it calls encode() then you should just be able to set 
$ENV{JSON_ANY_CONFIG} = utf8=1 in your application somewhere (probably in the prerun or init stages).



Just wondered if you had come across this and had any thoughts or suggestions.


But since the JSON_ANY_CONFIG thing isn't documented anywhere, it's probably best to use something 
else. How about $self-json_args()? It would just keep the args around and pass them to JSON::Any's 
new() method. So in your init/prerun you'd do something like this:


  $self-json_args(utf8 = 1);

And now that I think about it, all these json_* methods are kind of annoying. I probably should have 
gone with $self-json-* instead. Oh well...


--
Michael Peters
Plus Three, LP


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####