The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::Qmail::Queue::Error - Error handling for programs which emulate or use qmail-queue.

SYNOPSIS

  use Mail::Qmail::Queue::Error qw(:errcodes :fail);

  print "blah\n"
    or tempfail QQ_EXIT_WRITEERR,"Write error: $!\n";

  if (has_virus($body)) {
    permfail QQ_EXIT_REFUSED,"Message refused: it has a virus!!\n";
  }

  qfail $exit_status,"qmail-queue exited $exit_status\n";

DESCRIPTION

Mail::Qmail::Queue::Error is designed to simplify error handling for a program which emulates or uses a program implementing the qmail-queue(8) interface. It declares constants for a variety of permanent and temporary error codes, and provides shorthand methods similar to die that return an appropriate error code. It also provides some methods to look at an error code returned by qmail-queue and determine whether it is temporary or permanent.

CONSTANTS

These constants are defined in qmail-queue(8). They are mostly self-explanatory.

Permanent Errors

QQ_EXIT_ADDR_TOO_LONG
QQ_EXIT_REFUSED

Temporary Errors

QQ_EXIT_NOMEM
QQ_EXIT_TIMEOUT
QQ_EXIT_WRITEERR
QQ_EXIT_READERR
QQ_EXIT_BADCONF
QQ_EXIT_NETERR
QQ_EXIT_BADQHOME
QQ_EXIT_BADQUEUEDIR
QQ_EXIT_BADQUEUEPID
QQ_EXIT_BADQUEUEMESS
QQ_EXIT_BADQUEUEINTD
QQ_EXIT_BADQUEUETODO
QQ_EXIT_TEMPREFUSE
QQ_EXIT_CONNTIMEOUT
QQ_EXIT_NETREJECT
QQ_EXIT_NETFAIL
QQ_EXIT_BUG
QQ_EXIT_BADENVELOPE

FUNCTIONS

tempfail ( [$failcode,] @message )

Exit with a temporary failure code, or die if in an eval. If the first argument is numeric, or if the message starts with a number, that will be used as the exit code. Otherwise, the temporary failure code QQ_EXIT_BUG will be used.

Note that no checking of the failure code is done; if you pass a code that does not indicate temporary failure, it will be used as is.

permfail ( [$failcode,] @message )

Exit with a permanent failure code, or die if in an eval. If the first argument is numeric, that will be used as the exit code. Otherwise, the permanent failure code QQ_EXIT_REFUSED will be used.

Note that no checking of the failure code is done; if you pass a code that does not indicate permanent failure, it will be used as is.

qfail ( [$failcode,] @message )

Exit with a failure code, or die if in an eval. If the first argument is numeric, that will be used as the exit code. Otherwise, the temporary failure code QQ_EXIT_BUG will be used.

is_tempfail ( $exit_value )

Test if the provided value is a temporary exit status.

is_permfail

Test if the provided value is a permanent exit status.

SEE ALSO

qmail-queue(8), Mail::Qmail::Queue::Message, Mail::Qmail::Queue::Receive::Body, Mail::Qmail::Queue::Receive::Envelope, Mail::Qmail::Queue::Send.

COPYRIGHT

Copyright 2006 Scott Gifford.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.