++ed by:

1 non-PAUSE user(s).

Philip Gwyn

NAME

POEx::HTTP::Server::Error - Object encapsulating an error

SYNOPSIS

    use POEx::HTTP::Server;

    POEx::HTTP::Server->spawn( handlers => {
                on_error => 'poe:my-alias/error' );

    # events of session my-alias:
    sub error {
        my( $heap, $ereq ) = @_[HEAP,ARG0,ARG1];

        if( $err->op ) {
            warn $err->op, " error [", $err->errnum, "] ", $err->errstr;
        }
        else {
            warn $err->content;
        }
    }

DESCRIPTION

This object encapsulates a network error or an HTTP error for reporting to "on_error" in POEx::HTTP::Server special handlers.

Network errors are those reported by POE::Wheel::SocketFactory, POE::Wheel::ReadWrite and "sendfile" in Sys::Sendfile if that is used.

HTTP errors are those reported by POE::Filter::HTTPD when it detects a mal-formed header or errors internal to POEx::HTTP::Server. However, errors reported with "error" in POEx::HTTP::Server::Response do not invoke on_error.

HTTP errors are nearly always sent to the browser. You may modify the "content" in HTTP::Response or prevent them being sent by setting "sent" in POEx::HTTP::Server::Response.

HTTP errors will always close the connection, even if keep-alive is set.

METHODS

As this is a sub-class of POEx::HTTP::Server::Response, all that class's methods are available. Note, however, that "request" in POEx::HTTP::Server::Response might be undef.

op

Returns the name of the operation that failed. Can be one of read, write, bind or sendfile.

errnum

Returns the system error number; the numeric value of $!.

errstr

Returns the system error string; the string value of $!.

errstring

Same as "errstr".

SEE ALSO

POEx::HTTP::Server, POEx::HTTP::Server::Response, HTTP::Response.

AUTHOR

Philip Gwyn, <gwyn -at- cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Philip Gwyn

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.




Hosting generously
sponsored by Bytemark