scripted delete mailbox for cyradm
Aleksandar Milivojevic
amilivojevic at pbl.ca
Thu Feb 10 15:35:28 EST 2005
Craig White wrote:
> give me an error - failed to delete on line 12 but it does indeed
> delete. I'll have to debug later and investigate method of grabbing
> error and standard out that you pointed me to. I can see that this is
> trying to suck me into perl and I have avowed not to dirty my hands.
Hm, strange. I'd kinda expect delete to return something usable for
checking the error status.
Anyhow, instead of checking the return value of function, you can simply
check if error is defined (stolen from Cyrus::IMAP::Admin man page):
$imap->delete("user.public");
die $imap->error if $imap->error;
Of course, above error checking can be done in at least dozen more ways
(just like anything else in Perl). Perl supports various definitions of
what is beautiful code.
This will print usable error message in case of an error, and abort
further execution of the program.
(you may change all error checking of Cyrus::IMAP and Cyrus::IMAP::Admin
methods in entire script to be done like above).
--
Aleksandar Milivojevic <amilivojevic at pbl.ca> Pollard Banknote Limited
Systems Administrator 1499 Buffalo Place
Tel: (204) 474-2323 ext 276 Winnipeg, MB R3T 1L7
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
More information about the Info-cyrus
mailing list