httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Bloodgood" <r...@empire2.com>
Subject Adding parameters to a request
Date Wed, 20 Jun 2001 18:11:25 GMT
OK, I've reviewed the code, looked at the docs, but I'm getting nowhere.

In my AuthenHandler, I run the following snippet:

	# validation successful
	$apr->subprocess_env(REMOTE_PASSWORD => $pass);
      my $args = $apr->args || '';
	$apr->args( $args . ( length $args ? '&' : '' ) . "pid=$pid" )
           unless $args =~ /pid=\d+/;
	return OK;

The intent is to add the parameter 'pid=99' or whatever to the request if it
is not already present.

It feels clunky and forced to me... is there a better way to do this?  As
indicated by the variable, I'm using Apache::Request, for the sole purpose
of having easier access to the parameters.  Except that it turns out
Apache::Request's param() method does NOT support *setting* parameters, only
*getting* them. <sigh>

THEN somebody on mod_perl told me to try parms(), which led to:

    my $parms = $apr->parms;
    $parms->add( pid => $pid) unless defined $parms->get('pid');

    #	$args = $apr->args;
    #$apr->args($parms);
    $apr->parms($parms);

    #$apr->param(pid => $pid);
    #$apr->param(pid => [$pid]);
    #warn (Dumper [ {$apr->args}, $x, $apr->query_string ] );

    if (! defined $apr->param('pid')) {
	$apr->args( $args . ( length $args ? '&' : '' ) . "pid=$pid" ) 			unless
$args =~ /pid=\d+/;
    } else {
	#warn "param pid is DEFINED!!! : ", $apr->param('pid');
	$apr->args( $args . ( length $args ? '&' : '' ) . "pid=$pid" ) 			unless
$args =~ /pid=\d+/;
    }


As should be obvious, even when the Apache::Table $parms was coaxed into
accepting the value for pid, my HTML::Mason pages still bitched about the
missing parameter, and I had to do what I'd been doing all along, to fix it.

Am I doing something wrong?  Am I expecting functionality that is just plain
*not* supported?

TIA!

L8r,
Rob



Mime
View raw message