Server/Connection.pm

filter: Statementstmt 56.9% 33 / 58 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.3% 11 / 26 Podpod 71.4% 15 / 21 totaltotal 54.1% 59 / 109 CC 3 SCAR 7.8
CC
3
Cov
53%
user
6.0
authtype
6.0
remote_addr
2.0
CRAP 2.2
« Server.pm ↑ Summary Server/Error.pm »
1 # $Id: Connection.pm 716 2010-12-17 16:29:05Z fil $
2 # Copyright 2010 Philip Gwyn
3 package POEx::HTTP::Server::Connection;
4  
5 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 14 ▶use Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 14 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub new
12 17 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
13 17 my( $package, $ID, $socket ) = @_;
14 17 my $self = bless {ID=>$ID}, shift;
15 17 $self->__socket( $socket );
16 17 return $self;
17 }
18  
19 sub __socket
20 17 ▶{
Subroutine __socket: called CC=1 SCAR=0.0
21 17 my( $self, $socket ) = @_;
22  
23 17 my $peername = getpeername( $socket );
24 17 my $sockname = getsockname( $socket );
25  
26 17 my @in = sockaddr_in($peername);
27 17 $self->{remote_addr} = $in[1];
28 17 $self->{remote_ip} = inet_ntoa( $self->{remote_addr} );
29 17 $self->{remote_port} = $in[0];
30  
31 17 @in = sockaddr_in($sockname);
32 17 $self->{local_addr} = $in[1];
33 17 $self->{local_ip} = inet_ntoa($self->{local_addr});
34 17 $self->{local_port} = $in[0];
35 }
36  
37 ######################################
38 12 ▶sub ID { $_[0]->{ID} }
Subroutine ID: called CC=1 SCAR=0.0
Pod documented
39  
40 0 ▶sub remote_addr { $_[0]->{remote_addr} }
Subroutine remote_addr: not called CC=1 SCAR=6.9
Pod documented
41 0 ▶sub peeraddr { $_[0]->{remote_addr} }
Subroutine peeraddr: not called CC=1 SCAR=6.9
Pod documented
42 1 ▶sub remote_host { $_[0]->{remote_ip} }
Subroutine remote_host: called CC=1 SCAR=0.0
Pod documented
43 0 ▶sub peerhost { $_[0]->{remote_ip} }
Subroutine peerhost: not called CC=1 SCAR=6.9
Pod documented
44 0 ▶sub remote_ip { $_[0]->{remote_ip} }
Subroutine remote_ip: not called CC=1 SCAR=6.9
Pod documented
45 1 ▶sub remote_port { $_[0]->{remote_port} }
Subroutine remote_port: called CC=1 SCAR=0.0
Pod documented
46 0 ▶sub peerport { $_[0]->{remote_port} }
Subroutine peerport: not called CC=1 SCAR=6.9
Pod documented
47  
48 0 ▶sub local_addr { $_[0]->{local_addr} }
Subroutine local_addr: not called CC=1 SCAR=6.9
Pod documented
49 0 ▶sub hostaddr { $_[0]->{local_addr} }
Subroutine hostaddr: not called CC=1 SCAR=6.9
Pod documented
50 1 ▶sub local_host { $_[0]->{local_ip} }
Subroutine local_host: called CC=1 SCAR=0.0
Pod documented
51 0 ▶sub hosthost { $_[0]->{local_ip} }
Subroutine hosthost: not called CC=1 SCAR=6.9
Pod documented
52 0 ▶sub local_ip { $_[0]->{local_ip} }
Subroutine local_ip: not called CC=1 SCAR=6.9
Pod documented
53 1 ▶sub local_port { $_[0]->{local_port} }
Subroutine local_port: called CC=1 SCAR=0.0
Pod documented
54 0 ▶sub hostport { $_[0]->{local_port} }
Subroutine hostport: not called CC=1 SCAR=6.9
Pod documented
55  
56  
57 ######################################
58 0 ▶sub user {
Subroutine user: not called CC=2 SCAR=17.9
Pod undocumented
59 0 my $self = @_;
60 0 my $rv = $self->{user};
61 0 ▶ if (@_ == 2) { $self->{user} = $_[1] }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) 0 0 0
62 0 return $rv;
63 }
64  
65 0 ▶sub authtype {
Subroutine authtype: not called CC=2 SCAR=17.9
Pod undocumented
66 0 my $self = @_;
67 0 my $rv = $self->{authtype};
68 0 ▶ if (@_ == 2) { $self->{authtype} = $_[1] }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) 0 0 0
69 0 return $rv;
70 }
71
72 0 ▶sub aborted {
Subroutine aborted: not called CC=1 SCAR=6.9
Pod undocumented
73 0 return $_[0]->{aborted};
74 }
75
76 0 ▶sub fileno {
Subroutine fileno: not called CC=1 SCAR=6.9
Pod undocumented
77 0 return 0;
78 }
79
80 0 ▶sub clone {
Subroutine clone: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my $self = @_;
82 0 my $new = bless { %$self };
83 0 return $new;
84 }
85
86
87 14 1;
88  
89 __END__
« Server.pm ↑ Summary Server/Error.pm »