POEx::HTTP::Server::Error - Object encapsulating an error
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; } }
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.
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.
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.
undef
Returns the name of the operation that failed. Can be one of read, write, bind or sendfile.
read
write
bind
sendfile
Returns the system error number; the numeric value of $!.
Returns the system error string; the string value of $!.
Same as "errstr".
POEx::HTTP::Server, POEx::HTTP::Server::Response, HTTP::Response.
Philip Gwyn, <gwyn -at- cpan.org>
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.
To install POEx::HTTP::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POEx::HTTP::Server
CPAN shell
perl -MCPAN -e shell install POEx::HTTP::Server
For more information on module installation, please visit the detailed CPAN module installation guide.