lib/Morris.pm

filter: Statementstmt 56.4% 22 / 39 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 54.5% 6 / 11 Podpod 100% 2 / 2 totaltotal 49.1% 30 / 61 CC 5 SCAR 19.3
CC
5
Cov
48%
new_from_config
20.0
run
6.0
_build_condvar
2.0
CRAP 6.9
« blib/lib/Morris/Plugin/Oper.pm ↑ Summary blib/lib/Morris/Plugin/Log/DBI.pm »
1 package Morris;
2 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use AnyEvent;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Morris::Connection;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use namespace::clean -except => qw(meta);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use constant DEBUG => $ENV{PERL_MORRIS_DEBUG};
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '0.01000_01';
11  
12 2 has condvar => (
13 is => 'ro',
14 lazy_build => 1,
15 );
16  
17 2 has connections => (
18 traits => ['Array'],
19 is => 'ro',
20 isa => 'ArrayRef[Morris::Connection]',
21 lazy_build => 1,
22 handles => {
23 push_connection => 'push',
24 all_connections => 'elements',
25 }
26 );
27  
28 0 ▶sub _build_condvar { AnyEvent->condvar }
Subroutine _build_condvar: not called CC=1 SCAR=6.9
29 0 ▶sub _build_connections { [] }
Subroutine _build_connections: not called CC=1 SCAR=6.9
30 0 ▶sub _noop_cb {};
Subroutine _noop_cb: not called CC=1 SCAR=0.0
31  
32 0 ▶sub new_from_config {
Subroutine new_from_config: not called CC=4 SCAR=30.0
Pod documented
33 0 my ($class, $config) = @_;
34  
35 0 my $self = $class->new();
36  
37 0 ▶ while ( my ($name, $conn) = each %{$config->{connection}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$config{"connection"};}) 0 0 0
38 0 ▶ confess "No network specified for connection '$name'" unless $conn->{network};
Branch: 1 branch
BranchTrueFalseTotal
unless $conn->{"network"} 0 0 0
39  
40 0 my $network = $config->{network}->{ $conn->{network} };
41 0 ▶ $network->{server} ||= $conn->{network};
Condition0%0/3
$network->{"server"} ||= $conn->{"network"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$network->{"server"} ||= $conn->{"network"}
$network->{"server"} $conn->{"network"}
Truth table0%0/3
A ||= B
A= $network->{"server"}B= $conn->{"network"}
ABresult
1X1
011
000
42  
43 0 my $connection = Morris::Connection->new_from_config( {
44 %$network,
45 %$conn,
46 name => $name,
47 });
48 0 $self->push_connection( $connection );
49 }
50  
51 0 return $self;
52 }
53  
54 0 ▶sub run {
Subroutine run: not called CC=2 SCAR=17.9
Pod documented
55 0 my $self = shift;
56  
57 0 my $cv = $self->condvar;
58 0 $cv->begin();
59 0 foreach my $conn ($self->all_connections) {
60 0 $conn->run();
61 }
62 }
63  
64 2 __PACKAGE__->meta->make_immutable();
65  
66 2 1;
67  
68 __END__
« blib/lib/Morris/Plugin/Oper.pm ↑ Summary blib/lib/Morris/Plugin/Log/DBI.pm »