CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
mod_perl question



Nov 29, 2000, 12:46 PM

Post #1 of 2 (1239 views)
mod_perl question Can't Post

I am working on a mod_perl module that will update a value of a parameter and pass it on to the next handler. I read the "Writing Apache Module with Perl and C" from O'Reilly and couldn't find any setter to update path info, uri, or the arguements list. Since my client which make the request is not a web browser, construct a new URI with redirect respond code is not an option.


I want to update uniqueid to 8888 in mod_perl transparent to script.cgi and the client so that when script.cgi is executed, it will look like as if the request was

Any idea?
Thanks in advance.



Nov 30, 2000, 9:58 AM

Post #2 of 2 (1239 views)
Re: mod_perl question [In reply to] Can't Post

If I understand what you mean, you are running your script from a CONSOLE, and not a BROWSER, right? and you want it to read input from the CONSOLE input in the same fasion as the browser will? True False?

If your running this from the BROWSER, then use this code to read URI auruments.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

sub parse_form {
my (@pairs, %in);
my ($buffer, $pair, $name, $value);

if ($ENV{'REQUEST_METHOD'} eq 'GET') {
@pairs = split(/&/, $ENV{'QUERY_STRING'});
elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
else {
&cgierr('You cant run this script from telnet/shell.');

PAIR: foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);

$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

($value eq "---") and next PAIR;
exists $in{$name} ? ($in{$name} .= "~~$value") : ($in{$name} = $value);
return %in;
%in =&parse_form;

Then it will store the unique id in $in{'uniqueid'}



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives