You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andrew Fuqua <af...@austin.apc.slb.com> on 2000/08/14 18:44:15 UTC

$r->notes with slashes

I'm trying to pass a path name with slashes as the value of a note, and
when I try to retrieve the note from another handler in the same
request, the note is not there.  Code goes like this:

in a PerlInitHandler:
$r->notes('dir_name' => '/some/dir/name/');

later, in a PerlAuthzHandler:
my $dir_name = $r->notes('dir_name');

and $dir_name is empty. :(   I can set and retrieve the note just fine
as long as there are no slashes in the note.

Another question.  From a handler, how can I change the value of a
variable that was PerlSetVar'ed in httpd.conf?

Thanks,
Andrew


Re: $r->notes with slashes

Posted by Doug MacEachern <do...@covalent.net>.
On Mon, 14 Aug 2000, Andrew Fuqua wrote:

> I'm trying to pass a path name with slashes as the value of a note, and
> when I try to retrieve the note from another handler in the same
> request, the note is not there.  Code goes like this:
> 
> in a PerlInitHandler:
> $r->notes('dir_name' => '/some/dir/name/');
> 
> later, in a PerlAuthzHandler:
> my $dir_name = $r->notes('dir_name');
> 
> and $dir_name is empty. :(   I can set and retrieve the note just fine
> as long as there are no slashes in the note.

works fine for me with this test case:

<Location />
   PerlInitHandler 'sub { shift->notes(dir_name => "/some/dir/name/") }'
   require valid-user
   AuthType basic
   AuthName test
   PerlAuthenHandler Apache::OK
   PerlAuthzHandler 'sub { Apache::OK if shift->notes("dir_name") }'
</Location>
 
you'll only get prompted for user/pass if dir_name is not found in the 
notes table, does it work for you?

> Another question.  From a handler, how can I change the value of a
> variable that was PerlSetVar'ed in httpd.conf?

as geoff explained, you can, but the value might stick for that child if
the SetVar was configured in httpd.conf.  so you might want to reset it:

my $old_val = $r->dir_config->get('foo');

$r->register_cleanup(sub { shift->dir_config->set(foo => $old_val) });

$r->dir_config->set(foo => $new_val);