# create an IMAP connection eval { # This is the inserted line. local $SIG{__WARN__} = sub {die @_}; $imap = Mail::IMAPClient->new( Server => $IMAP, User => $UNAME, Password => $PWD, Uid => 0, Debug => $DEBUGGING, ) or carp "Cannot connect to $IMAP as $UNAME: $@"; };