DBus/Path.pm

filter: Statementstmt 70.8% 17 / 24 Branchbran 33.3% 2 / 6 Conditioncond 25.0% 2 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 52.9% 27 / 51 CC 7 SCAR 23.6
CC
7
Cov
55%
login_session_message_bus
19.8
system_message_bus
2.1
BEGIN
1.0
CRAP 10.6
« DBus/Client.pm ↑ Summary DBus/Client/AnyEvent.pm »
1 package Protocol::DBus::Path;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 ▶use Protocol::DBus::Address ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶use constant _DEFAULT_SYSTEM_MESSAGE_BUS => 'unix:path=/var/run/dbus/system_bus_socket';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # NB: If this returns “autolaunch:”, then the system should use
11 # platform-specific methods of locating a running D-Bus session server,
12 # or starting one if a running instance cannot be found.
13 1 ▶sub login_session_message_bus {
Subroutine login_session_message_bus: called CC=6 SCAR=29.9
Pod undocumented
14 1 my $addr = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
15  
16 1 ▶ if (!$addr && ($^O eq 'darwin')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $addr and $^O eq "darwin") 0 1 1
Condition33%1/3
not $addr and $^O eq "darwin"
!ll&&!rl&&r
010
MC/DC0%0/2
not $addr and $^O eq "darwin"
not $addr $^O eq "darwin"
Truth table33%1/3
not(A) and B
A= not $addrB= $^O eq "darwin"
ABresult
0X0
100
111
17 0 my $path = $ENV{'DBUS_LAUNCHD_SESSION_BUS_SOCKET'};
18  
19 # OK, let’s *really* stretch …
20 0 ▶ $path ||= readpipe( "launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET" );
Condition0%0/3
$path ||= `launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET`
l!l&&r!l&&!r
000
MC/DC0%0/2
$path ||= `launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET`
$path `launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET`
Truth table0%0/3
A ||= B
A= $pathB= `launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET`
ABresult
1X1
011
000
21 0 chomp $path;
22  
23 0 ▶ if ($path) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path) 0 0 0
24 0 chomp $path;
25  
26 0 $addr = "unix:path=$path";
27 }
28 }
29  
30 1 ▶ die "Found no login session message bus address!" if !$addr;
Branch: 1 branch
BranchTrueFalseTotal
unless $addr 1 0 1
31  
32 0 return Protocol::DBus::Address::parse($addr);
33 }
34  
35 1 ▶sub system_message_bus {
Subroutine system_message_bus: called CC=2 SCAR=7.6
Pod undocumented
36 1 ▶ return Protocol::DBus::Address::parse( $ENV{'DBUS_SYSTEM_BUS_ADDRESS'} || _DEFAULT_SYSTEM_MESSAGE_BUS() );
Condition50%1/2
$ENV{'DBUS_SYSTEM_BUS_ADDRESS'} || 'unix:path=/var/run/dbus/system_bus_socket'
l!l
01
MC/DC0%0/1
$ENV{'DBUS_SYSTEM_BUS_ADDRESS'} || 'unix:path=/var/run/dbus/system_bus_socket'
$ENV{'DBUS_SYSTEM_BUS_ADDRESS'}
Truth table50%1/2
A
A= $ENV{'DBUS_SYSTEM_BUS_ADDRESS'}
Aresult
11
00
37 }
38  
39 6 1;
« DBus/Client.pm ↑ Summary DBus/Client/AnyEvent.pm »