Re: Calling a mod_perl method from whithin a CGI script

2003-07-21 Thread Stas Bekman
Eric Ricardo Anton wrote:
I have started using Apache::AuthCookie, which runs under mod_perl, 
for authentication. The problem is that the whole website Im working on 
is based on mod_cgi. I need the CGI scripts to call a mod_perl method in 
order to recognize the user that is logged in.

Since I can't port the scripts from mod_cgi to mod_perl, how can I 
make a CGI script call a mod_perl method?

Thanks for any help.
let's say you have a script:

print Content-type: text/plain\n\n;
print Hello whoever you are\n;
now you change it to be:

my $r = shift;
my $username = $r-connection-user || '';
print Content-type: text/plain\n\n;
print Hello $username\n;
or:

my $r = Apache-request;
my $username = $r-connection-user || '';
print Content-type: text/plain\n\n;
print Hello $username\n;
This is correct for mp1.

__
Stas BekmanJAm_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


Re: Calling a mod_perl method from whithin a CGI script

2003-07-21 Thread Perrin Harkins
On Sun, 2003-07-20 at 17:15, Eric Ricardo Anton wrote:
   Since I can't port the scripts from mod_cgi to mod_perl, how can I make 
 a CGI script call a mod_perl method?

You can't.  When you run a script under mod_cgi, mod_perl functions are
not available.  However, you could try running your scripts under
Apache::Registry, and then you'd be able to use the mod_perl API.

- Perrin