Server/Http.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Server/Elasticsearch.pm ↑ Summary Server/Kafka.pm »
1 #
2 # $Id$
3 #
4 # server::http Brik
5 #
6 package Metabrik::Server::Http;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
17 license => 'http://opensource.org/licenses/BSD-3-Clause',
18 attributes => {
19 datadir => [ qw(datadir) ],
20 hostname => [ qw(listen_hostname) ],
21 port => [ qw(listen_port) ],
22 _http => [ qw(INTERNAL) ],
23 },
24 attributes_default => {
25 hostname => 'localhost',
26 port => 8888,
27 },
28 commands => {
29 start => [ qw(listen_hostname|OPTIONAL listen_port|OPTIONAL datadir|OPTIONAL) ],
30 },
31 require_modules => {
32 'HTTP::Server::Brick' => [ ],
33 },
34 };
35 }
36  
37 sub start {
38 my $self = shift;
39 my ($hostname, $port, $root) = @_;
40  
41 $hostname ||= $self->hostname;
42 $port ||= $self->port;
43 $root ||= $self->datadir;
44  
45 my $http = HTTP::Server::Brick->new(
46 port => $port,
47 host => $hostname,
48 timeout => defined($self->global) && $self->global->rtimeout || 3,
49 );
50  
51 $http->mount('/' => { path => $root });
52  
53 return $self->_http($http)->start;
54 }
55  
56 1;
57  
58 __END__
« Server/Elasticsearch.pm ↑ Summary Server/Kafka.pm »