File Coverage

blib/lib/POE/Component/Server/HTTPServer/NotFoundHandler.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 4 0.0
condition n/a
subroutine 4 6 66.6
pod 1 2 50.0
total 17 35 48.5


line stmt bran cond sub pod time code
1             package POE::Component::Server::HTTPServer::NotFoundHandler;
2 1     1   1388 use strict;
  1         2  
  1         37  
3 1     1   15 use HTTP::Status;
  1         1  
  1         507  
4 1     1   8 use POE::Component::Server::HTTPServer::Handler qw( H_CONT H_FINAL );
  1         3  
  1         1716  
5 1     1   8 use base 'POE::Component::Server::HTTPServer::Handler';
  1         2  
  1         334  
6              
7             our $Instance;
8              
9             sub new {
10 0     0 0   my $class = shift;
11 0 0         $Instance = bless {}, $class
12             unless defined($Instance);
13 0           return $Instance;
14             }
15              
16             sub handle {
17 0     0 1   my $self = shift;
18 0           my $context = shift;
19 0           $context->{response}->code( RC_NOT_FOUND );
20 0           my $message = "";
21 0 0         if ( defined($context->{error_message}) ) {
22 0           $message = ":
$context->{error_message}\n";
23             }
24 0           $context->{response}->content("Not Found$message");
25 0           return H_FINAL;
26             }
27              
28             1;
29             __END__