You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Alan Wilson <al...@ed.ac.uk> on 2003/04/08 16:28:08 UTC

Newbie Problems

Hi All,

I'm having some problems with Apache authenticating to an IMAP server using the AuthenIMAP perl module.

I'm a newbie with mod_perl but i followed the instructions at:

http://perl.apache.org/docs/2.0/user/index.html to get it installed.

I'm running apache-2.045 and mod_perl 1.99_08 and Apache::AuthenIMAP 0.03.

When I try to access a directory that should be password protected i get a 500 Internal server error and the following entry in apache error_log

[Tue Apr 08 15:09:46 2003] [error] [client 129.215.162.150] Usage: Apache::RequestRec::notes(obj,val=NULL) at /usr/lib/perl5/site_perl/5.8.0/Apache/AuthenIMAP.pm line 95.

I've checked the AuthenIMAP.pm code carefully and the Apache::RequestRec code does not occur in it anywhere.

The module is originally for mod_perl 1.x but i've converted it to work for 2.X (just required changing $r->connection->user to $r->user. 

The annoying thing is i had the exact same setup working on a test box (sadly now blitzed) but trying it on the real machine just barfs with the above error.

If anyone can shed any light on what's happening i would be very grateful.

Cheers

Alan./

Re: Newbie Problems

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Geoffrey Young wrote:
>  >
>  >
>  > Perrin Harkins wrote:
>  >
>  >> Alan Wilson wrote:
>  >>
>  >>> Line 95 is:
>  >>>
>  >>> $r->notes($imap_username . 'Group', $group);
> 
> It looks like a bug. Let me ponder on it.

Ah, similar to header_out, header_in, err_header_out the old API is not 
supported in 2.0 (the method name is the same though). I've committed a 
wrapper that will work as in mp1 with Apache::compat loaded. The compat docs 
are now updated.

So either use Apache::compat with the latest cvs, or use the new API, which is 
supported by mp1 as well. You get the APR::Table object and then you can call 
methods on it, or use it's tied hash interface. See:
http://perl.apache.org/docs/2.0/api/APR/Table.html


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


Re: Newbie Problems

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
 >
 >
 > Perrin Harkins wrote:
 >
 >> Alan Wilson wrote:
 >>
 >>> Line 95 is:
 >>>
 >>> $r->notes($imap_username . 'Group', $group);

It looks like a bug. Let me ponder on it.

If you are in real hurry, or have to use the release mod_perl, use the 
APR::Table syntax for now: $r->notes->set(foo => 'bar'). grep the t/ dir in 
the source distro for many examples.

 >> Now that I look at it, there doesn't seem to be any notes() method in
 >> Apache::RequestRec.

That wasn't the real problem since it was reporting invalid method usage == it 
did find the right method, so Apache::RequestRec was already loaded.

Nevertheless when in doubt use the following to map methods to their 
containing classes.
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#Command_Line_Lookups

% lookup notes
There is more than one class with method 'notes'
try one of:
         use Apache::Connection ();
         use Apache::RequestRec ();

 > just FYI, it's there in WrapXS/Apache/RequestRec/RequestRec.xs:
 >
 > MODULE = Apache::RequestRec    PACKAGE = Apache::RequestRec
 >
 > APR::Table
 > notes(obj, val=NULL)
 >
 >
 > you need to include a
 >
 > use Apache::RequestRec
 >
 > in your code port, or simply use Apache::compat someplace (such as in a
 > startup file, PerlModule statement, or in the code itself).

Just a minor comment: when people do port their code and all is missing is 
loading of some packages, it's probably not the best idea to suggest using 
Apache::compat, even though it works.

I'd rather see people suggest using:
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#preload_all_modules__
as a short-term pain-relief pill.


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


Re: Newbie Problems

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Perrin Harkins wrote:
> Alan Wilson wrote:
> 
>> Line 95 is:
>>
>> $r->notes($imap_username . 'Group', $group);
> 
> 
> Now that I look at it, there doesn't seem to be any notes() method in 
> Apache::RequestRec.  

just FYI, it's there in WrapXS/Apache/RequestRec/RequestRec.xs:

MODULE = Apache::RequestRec    PACKAGE = Apache::RequestRec

APR::Table
notes(obj, val=NULL)


you need to include a

use Apache::RequestRec

in your code port, or simply use Apache::compat someplace (such as in a 
startup file, PerlModule statement, or in the code itself).

HTH

--Geoff


Re: Newbie Problems

Posted by Perrin Harkins <pe...@elem.com>.
Alan Wilson wrote:
> Line 95 is:
> 
> $r->notes($imap_username . 'Group', $group);

Now that I look at it, there doesn't seem to be any notes() method in 
Apache::RequestRec.  Are you using the compat module?

- Perrin



Re: Newbie Problems

Posted by Alan Wilson <al...@ed.ac.uk>.
Line 95 is:

$r->notes($imap_username . 'Group', $group);

Cheers

Alan./


Perrin Harkins wrote:
> 
> On Tue, 2003-04-08 at 10:28, Alan Wilson wrote:
> > [Tue Apr 08 15:09:46 2003] [error] [client 129.215.162.150] Usage: Apache::RequestRec::notes(obj,val=NULL) at /usr/lib/perl5/site_perl/5.8.0/Apache/AuthenIMAP.pm line 95.
> 
> Looks like it's objecting to a use of $r->notes() at line 95.  What's
> there?
> 
> - Perrin

Re: Newbie Problems

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2003-04-08 at 10:28, Alan Wilson wrote:
> [Tue Apr 08 15:09:46 2003] [error] [client 129.215.162.150] Usage: Apache::RequestRec::notes(obj,val=NULL) at /usr/lib/perl5/site_perl/5.8.0/Apache/AuthenIMAP.pm line 95.

Looks like it's objecting to a use of $r->notes() at line 95.  What's
there?

- Perrin