You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mark Fowler <ma...@twoshortplanks.com> on 2002/05/01 11:27:15 UTC

Re: Perl Callbacks not working

On Tue, 30 Apr 2002, Vitor wrote:

> use strict;
> use Mail::CClient qw(set_callback);
> set_callback (login=> sub { return ("login","password"); } )

I don't see any reason why this shouldn't work.  Acmemail (which runs fine 
under mod_perl) uses Mail::CClient with callbacks without problem.

> I think this is related with the cacching feature of mod_perl that need to
> be disabled for pages that uses these callbacks.

What are you expecting to happen here?  When Mail::CClient needs a login 
it will call the anonymous subroutine passed on login which will simply 
return the two values "login" and "password".  These need to be set to the 
login and password of your POP/IMAP/Whatever account.

You could be getting things confused with closures here, it's reasonably 
easy to do.

  sub init
  {
     my $login,$password;
     set_callback (login=> sub { return ($login,$password); } )
  }

Will not login no matter what you set $login or $password to be later as 
the anonymous subroutine will be bound to the particular $login and 
$password created in init.

Hope this is helpful (and the problem isn't more serious)

Mark.

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              mark@twoshortplanks.com
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}


RES: Perl Callbacks not working

Posted by Vitor <vs...@uol.com.br>.
Mark,

First, thanks for you reply.

I know that Acmemail runs fine under mod_perl.

I think the reason for this is that their script runs as an common CGI, and
not as a cached bytecode.

About you second suggestion, i just changed the values of login and password
that i use.

Best Regards,

Vitor

-----Mensagem original-----
De: Mark Fowler [mailto:mark@astray.com]Em nome de Mark Fowler
Enviada em: quarta-feira, 1 de maio de 2002 06:27
Para: Vitor
Cc: modperl@apache.org
Assunto: Re: Perl Callbacks not working


On Tue, 30 Apr 2002, Vitor wrote:

> use strict;
> use Mail::CClient qw(set_callback);
> set_callback (login=> sub { return ("login","password"); } )

I don't see any reason why this shouldn't work.  Acmemail (which runs fine
under mod_perl) uses Mail::CClient with callbacks without problem.

> I think this is related with the cacching feature of mod_perl that need to
> be disabled for pages that uses these callbacks.

What are you expecting to happen here?  When Mail::CClient needs a login
it will call the anonymous subroutine passed on login which will simply
return the two values "login" and "password".  These need to be set to the
login and password of your POP/IMAP/Whatever account.

You could be getting things confused with closures here, it's reasonably
easy to do.

  sub init
  {
     my $login,$password;
     set_callback (login=> sub { return ($login,$password); } )
  }

Will not login no matter what you set $login or $password to be later as
the anonymous subroutine will be bound to the particular $login and
$password created in init.

Hope this is helpful (and the problem isn't more serious)

Mark.

--
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              mark@twoshortplanks.com
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}