RE: [Mimedefang] Embedded Perl External Perl Modules
Chris Masters wrote: I've just tested the embedded perl option and they don't seem to be functioning properly. The first module (Net::LDAP) that gets used doesn't function properly (cannot establish connections). If I change back to normal [non-embedded] mode it's fine. Are there any issues with using perl modules when mimedefang runs in embedded mode? There's a new section in the mimedefang-filter man page with the heading INITIALIZATION AND CLEANUP which says, in part: ... How-ever, if you are using an embedded Perl interpreter, then anything you call directly from outside a function definition is executed once only in the parent process. Anything in filter_initialize is executed once per slave. If you use any code that opens a descriptor (for example, a connection to a database server), you must run that code inside filter_initialize and not directly from the filter, because the multiplexor closes all open descriptors when it activates a new slave. If you are creating a new instance of the Net::LDAP object directly in your filter file (outside of any subroutine), then try creating the filter_initialize sub moving that initialization inside it. HTH ___ Michael Sims Project Analyst - Information Technology Crye-Leike Realtors Office: (901)758-5648 Pager: (901)769-3722 ___ ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
RE: [Mimedefang] Embedded Perl External Perl Modules
--- Michael Sims [EMAIL PROTECTED] wrote: Chris Masters wrote: I've just tested the embedded perl option and they don't seem to be functioning properly. The first module (Net::LDAP) that gets used doesn't function properly (cannot establish connections). If I change back to normal [non-embedded] mode it's fine. Are there any issues with using perl modules when mimedefang runs in embedded mode? If you are creating a new instance of the Net::LDAP object directly in your filter file (outside of any subroutine), then try creating the filter_initialize sub moving that initialization inside it. Hmmm. I initialise all connection handles in a getConnection function that checks the connection and opens one if necessary (because there never used to be a filter_initialize function and it's very resilient). Any other reasons? Thanks for your response Michael. __ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
RE: [Mimedefang] Embedded Perl External Perl Modules
On Wed, 5 May 2004, Chris Masters wrote: Hmmm. I initialise all connection handles in a getConnection function that checks the connection and opens one if necessary (because there never used to be a filter_initialize function and it's very resilient). Any other reasons? We've noticed a problem with error reporting and the embedded interpreter, but haven't been able to track it down. Try wrapping your use statements in a BEGIN { eval { use XXX; } or die (Error with use: $@); } Regards, David. ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
RE: [Mimedefang] Embedded Perl External Perl Modules
--- David F. Skoll [EMAIL PROTECTED] wrote: On Wed, 5 May 2004, Chris Masters wrote: Hmmm. I initialise all connection handles in a getConnection function that checks the connection and opens one if necessary (because there never used to be a filter_initialize function and it's very resilient). Any other reasons? We've noticed a problem with error reporting and the embedded interpreter, but haven't been able to track it down. Try wrapping your use statements in a BEGIN { eval { use XXX; } or die (Error with use: $@); } Thanks David. Already doing that - the error is based around the connection error: Can't locate object method new via package Net::LDAP::Bind at /usr/lib/perl5/site_perl/5.8.0/Net/LDAP.pm line 227. H. This is the same error if it cannot connect. I can recreate and test further if required. Cheers, Chris code: eval { md_syslog('info',Connecting to LDAP Directory); $ldap = Net::LDAP-new($LDAPServer,timeout = $LDAPTimeout); $mesg = $ldap-bind($LDAP_user, password = $LDAP_passwd); if ($mesg-code) { use Net::LDAP::Util qw(ldap_error_text); $error = ldap_error_text($mesg-code); md_syslog('err',LDAP Connect Error: $error); undef $ldap; } }; if($@ || !defined($ldap)) { action_tempfail(LDAP Connect Error(Queuing mail)); md_syslog('err',LDAP Error: $@); undef $ldap; } __ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover ___ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang