| sili | perltoot |
| anno_ | you'll have to bless it |
| action | CPAN upload: Sys-Statistics-Linux-0.09_15 by BLOONIX |
| CPAN | upload: Sys-Statistics-Linux-0.09_15 by BLOONIX |
| [miles] | afternoon #perl guys, I have an ldap lookup, that may or may not fail when it fails, I get an error in the logs... how can I supress errors in a section of code please? |
| anno_ | what logs? |
| [miles] | $result = $ldap->search( anno_: hi anno, it's a modification to spamassassins ldap prefs lookup |
| action | anno_ shrugs |
| anno_ | shrugs |
| [miles] | nothing like in php using @ ? |
| anno_ | i don't know the internals of spamassassin |
| scrottie | close STDERR. |
| [miles] | it's just that one command I need to suppres it's gonna be called repeatadly and very frequently, so it needs to be fast scrottie: and to open it again? open STDERR ? |
| scrottie | depends. there are different kinds of errors. syntax errors, raised errors, fatals, uncaught dies, uncaught warns.... |
| Prof_Vince | maybe the ldap constructor has something for suppressing that |
| scrottie | uh, no. once closed, it stays closed. there's no /dev/stdout you can open. that was kind of an obnoxious answer. sorry. |
| [miles] | Apr 20 12:57:44 spamwall spamd[4627]: dc=bankingspain.com,ou=domains,dc=entorno,dc=es: No such object at /usr/local/share/perl/5.8.7/Mail/SpamAssassin/Conf/LDAP.pm line 198 |
| scrottie | but I really can't make a useful suggestion without knowing more about what kind of error it is. |
| [miles] | that gets put in mail.log |
| anno_ | ugh |
| [miles] | only cos in this, it loads domain prefs only, there is no user |
| scrottie | eval { } around the LDAP call and then inspect $@ if you like. it'll contain the text of the error if there wa sone. |
| [miles] | which is fine, as it's allready loaded the domain prefs.. |
| scrottie | as Prof_Vince said, there may also be an option to turn off the raised errors. |
| [miles] | Prof_Vince: hello Prof_Vince: any ideas please thank you scrottie |
| anno_ | a failed ldap search doesn't die. the return value has its ->code set, iirc |
| scrottie | /Mail/SpamAssassin/Conf/LDAP.pm line 198 yeah. M::SA. stupid thing. change that line of code. it's probably a 'warn' or something. |
| [miles] | scrottie: nod scrottie: it is working correctly... |
| anno_ | warn can be caught via $SIG{ __WARN__} |
| [miles] | scrottie: just have to supress it in the user prefs |