http://www.perlmonks.org?node_id=705091


in reply to Mail::IMAPTalk and mod_perl

You have:

if ( ! exists $our_cache_imap_object ) {

there. exists checks if a hask or array element does exist. You should rather check whether the object is defined, e.g.:

if ( ! defined $our_cache_imap_object ) {

Mail::IMAPTalk's constructor supports being passed a reference to a Socket. You can do some magic with that. You might want to take a look at Socket::PassAccessRights, which you could use to pass sockets to an external daemon, which would ensure that the connection is not lost and get the sockets back agian.

Replies are listed 'Best First'.
Re^2: Mail::IMAPTalk and mod_perl
by avo (Pilgrim) on Aug 19, 2008 at 08:06 UTC
    Sorry, copy - paste mistake... I was just making a small example of what the real program does. The real program keeps the objects into a hash. In other words $our_cache_imap_object is actually $our_cache_imap_object{$login$userid}. When copying and pasting I never read carefully what I am publishing. The case is checking for defined actually. Do you know whether I can somehow open a shared (per module) socket upon loading of the module by Apache in mod_perl environment?