Paul Flinders wrote:
I'm currently investigating using Apache::PageKit to develop
a web application.

I'm more-or-less constrained to use Apache 2 by the environmental
requirements for the project which means mod_perl2 and libapreq2.
I realise that this is something of an experimental brew, especially
as PageKit doesn't claim to support mod_perl2 yet.

At present I'm not getting much further than the start-up code. The
sequence

my $s = Apache->server;

 my $uid = $s->uid;
 my $gid = $s->gid;

gives me

Syntax error at /etc/httpd/conf.d/perl.conf:66
  Can't locate object method "uid" via package "Apache::Server"
  at /usr/lib/perl5/site_perl/5.8.0/Apache/PageKit.pm line 61.

Neither Apache::compat, Apache::porting nor the migration documentation
seem to have any hints.

How do I accomplish the above in mod_perl2?

Paul, you've just spotted two methods that we have forgotten to port to mp2.


I've looked at the sources of apache-1.3 and httpd-2.0 and here is what happening: apache-1.3 had server_rec records for server_uid and server_gid. httpd-2.0 doesn't have them, because httpd-2.0 the directives User and Group are platform specific. And only UNIX supports it, as you can see:
http://httpd.apache.org/docs-2.0/mod/mpm_common.html#user


Therefore it looks like we can't support these functions in mp2.

I guess we could try adding to compat.pm

sub Apache::Server::uid { $< }
sub Apache::Server::gid { $( }

Can anybody see problems with this approach?

I'm not sure we will be able emulate it correctly if you were relying on User/Group setting for suexec, which now uses a new directive SuexecUserGroup.
http://httpd.apache.org/docs-2.0/mod/mod_suexec.html#suexecusergroup
You can always get the real uid of the process with $< and real gid with $(.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to