| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Web::Dash::Util; |
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Future::Q; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
5
|
1
|
|
|
1
|
|
531
|
use Net::DBus; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Net::DBus::Annotation qw(dbus_call_async); |
|
7
|
|
|
|
|
|
|
use Try::Tiny; |
|
8
|
|
|
|
|
|
|
use Exporter qw(import); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(future_dbus_call); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub future_dbus_call { |
|
13
|
|
|
|
|
|
|
my ($dbus_object, $method, @args) = @_; |
|
14
|
|
|
|
|
|
|
return Future::Q->try(sub { |
|
15
|
|
|
|
|
|
|
my $future = Future::Q->new; |
|
16
|
|
|
|
|
|
|
$dbus_object->$method(dbus_call_async, @args)->set_notify(sub { |
|
17
|
|
|
|
|
|
|
my $reply = shift; |
|
18
|
|
|
|
|
|
|
try { |
|
19
|
|
|
|
|
|
|
$future->fulfill($reply->get_result); |
|
20
|
|
|
|
|
|
|
}catch { |
|
21
|
|
|
|
|
|
|
my $e = shift; |
|
22
|
|
|
|
|
|
|
$future->reject($e); |
|
23
|
|
|
|
|
|
|
}; |
|
24
|
|
|
|
|
|
|
}); |
|
25
|
|
|
|
|
|
|
return $future; |
|
26
|
|
|
|
|
|
|
}); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |