+2  A: 

Change your script to:

use CGI;
use Data::Dumper;

my $query = CGI->new; # even though I'd rather call the object $cgi
print $query->header('text/plain'), Dumper($query);

and take a look at what is being passed to your script and update your question with that information.

Sinan Ünür
-1 that prepares a response, it doesn't show the input. The input query string comes from the environment variable QUERY_STRING.
Kinopiko
@Kinopiko Look at the output in front of you. The parameters that will be in that `$cgi` object will only be the parameters passed via post, not via the URL. That ought to then spark something that says ... hmmmm ... maybe the problem is not with `mod_rewrite`. *How do I access the parameter passed in the URL when the form I am processing was POSTed?* Let me see the CGI docs. Admittedly more indirect than `@chaos`s answer but still leading the OP in the right direction. Now, if you do not understand what is in the `$cgi` object, then that is a completely different matter.
Sinan Ünür
Sorry, my mistake. I didn't notice the Dumper ($query) part.
Kinopiko
Too late to change the vote, tough luck!
Kinopiko
+5  A: 

If you're doing a POST query, you need to use $query->url_param('action') etc. to get parameters from the query string. You don't need or benefit from the QSA modifier.

chaos
$query->url_param() did the trick. I was dumping the $query param initially to try to see if it was being passed to CGI.pm but I guess that parameters in the POST URL aren't actually part of the $query object. Interesting but at least I now have the solution. Thanks for the quick response Sinan!
Russell C.
@Russell C. I think you should be thanking @chaos. Now, who downvoted my answer?
Sinan Ünür
Oops. New here. I meant, thanks @chaos!
Russell C.
Well, don't I get any thanks for actually linking his answer to the docs? ***I am joking***
Sinan Ünür
Thanks Sinan. :) And yeah, what's the deal with the downvoting on this question? Harsh, yo.
chaos
A: 

You could just look at $ENV{QUERY_STRING} actually. This will tell you exactly what is being passed from the web server to your script after the rewrite has been done, without making use of the CGI module. I think this is a good way to debug this kind of problem.

Kinopiko
Don't reinvent the wheel. Use `CGI.pm` (or actually, `CGI::Simple` for pure OO).
Sinan Ünür
Well, that attitude of reinventing the wheel all the time is not productive. See http://perldoc.perl.org/perlfaq9.html#How-do-I-decode-a-CGI-form%3f : *Many people try to write their own decoder (or copy one from another program) and then run into one of the many "gotchas" of the task.*
Sinan Ünür
This answer doesn't really deserve to be downvoted. It's correct and it might even be useful to someone.
Kinopiko