lib/Rex/Virtualization/VBox/bridge.pm

filter: Statementstmt 48.4% 16 / 33 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 42.0% 21 / 50 CC 8 SCAR 38.0
CC
8
Cov
37%
execute
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 44.7
« lib/Rex/Virtualization/VBox/forward_port.pm ↑ Summary lib/Rex/Commands/Box.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Virtualization::VBox::bridge;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.16.1'; # VERSION
11  
12 1 ▶use Rex::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 0 ▶sub execute {
Subroutine execute: not called CC=8 SCAR=42.8
Pod undocumented
18 0 my $class = shift;
19  
20 0 my $result = i_run "VBoxManage list bridgedifs", fail_ok => 1;
21 0 ▶ if ( $? != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? != 0) 0 0 0
22 0 die("Error running VBoxManage list bridgedifs");
23 }
24  
25 0 my @ifs;
26 0 my @blocks = split /\n\n/m, $result;
27 0 for my $block (@blocks) {
28  
29 0 my $if = {};
30 0 my @lines = split /\n/, $block;
31 0 for my $line (@lines) {
32 0 ▶ if ( $line =~ /^Name:\s+(.+?)$/ ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($line =~ /^Name:\s+(.+?)$/u) { } 0 0 0
elsif ($line =~ /^IPAddress:\s+(.+?)$/u) { } 0 0 0
elsif ($line =~ /^NetworkMask:\s+(.+?)$/u) { } 0 0 0
elsif ($line =~ /^Status:\s+(.+?)$/u) { } 0 0 0
33 0 $if->{name} = $1;
34 }
35 elsif ( $line =~ /^IPAddress:\s+(.+?)$/ ) {
36 0 $if->{ip} = $1;
37 }
38 elsif ( $line =~ /^NetworkMask:\s+(.+?)$/ ) {
39 0 $if->{netmask} = $1;
40 }
41 elsif ( $line =~ /^Status:\s+(.+?)$/ ) {
42 0 $if->{status} = $1;
43 }
44 }
45  
46 0 push @ifs, $if;
47 }
48  
49 0 return \@ifs;
50 }
51  
52 1 1;
« lib/Rex/Virtualization/VBox/forward_port.pm ↑ Summary lib/Rex/Commands/Box.pm »