Re: $r->notes with slashes

2000-08-30 Thread Doug MacEachern

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:


   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") }'

 
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);





Re: $r->notes with slashes

2000-08-14 Thread Ken Williams

Geoffrey Young wrote:
> 
> > -Original Message-
> > From: Andrew Fuqua [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, August 14, 2000 12:44 PM
> > To: [EMAIL PROTECTED]
> > Subject: $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.
> 
> try pnotes:
> $r->pnotes(dir_name => $some_string);
> or
> $r->pnotes(dir_name => \$some_string);

If that works, then $r->notes is broken and needs to be fixed.  My guess
is that it would be an Apache problem, not a mod_perl specific one.



RE: $r->notes with slashes

2000-08-14 Thread Geoffrey Young



> -Original Message-
> From: Andrew Fuqua [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 14, 2000 12:44 PM
> To: [EMAIL PROTECTED]
> Subject: $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.

try pnotes:
$r->pnotes(dir_name => $some_string);
or
$r->pnotes(dir_name => \$some_string);

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

you can use Apache::Table to get or set things in PerlSetVar:
$r->dir_config->get('foo');
$r->dir_config->set(foo => 'changed');

I haven't changed PerlSetVar like this, but a quick test showed that it
worked ok...

I've noticed that the Apache::Table way only works for PerlSetVar things on
a per-directory basis - it doesn't seem to inherit per-server variables
properly at this time...

HTH

--Geoff

> 
> Thanks,
> Andrew
> 



$r->notes with slashes

2000-08-14 Thread Andrew Fuqua

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