DBus/Client/EventMessenger.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 45 CC 1 SCAR 6.9
CC
1
Cov
0%
send_call
2.0
send_return
2.0
send_error
2.0
CRAP 2.0
1 package Protocol::DBus::Client::EventMessenger;
2  
3 use strict;
4 use warnings;
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Protocol::DBus::Client::EventMessenger - Messenger for
11 L<Protocol::DBus::Client::EventBase> subclasses.
12  
13 =head1 DESCRIPTION
14  
15 This module is instantiated automatically by
16 L<Protocol::DBus::Client::EventBase>.
17  
18 =head1 INSTANCE METHODS
19  
20 This class provides the following methods that provide the same interfaces
21 as their counterparts in L<Protocol::DBus::Peer>:
22  
23 =over
24  
25 =item * C<send_call()>
26  
27 =item * C<send_return()>
28  
29 =item * C<send_error()>
30  
31 =item * C<send_signal()>
32  
33 =back
34  
35 =cut
36  
37 sub send_call { _wrap_send( 'send_call', @_ ) }
38  
39 sub send_return { _wrap_send( 'send_return', @_ ) }
40  
41 sub send_error { _wrap_send( 'send_error', @_ ) }
42  
43 sub send_signal { _wrap_send( 'send_signal', @_ ) }
44  
45 =pod
46  
47 The following control whether to accept incoming messages from D-Bus:
48  
49 =over
50  
51 =item * C<pause()>
52  
53 =item * C<resume()>
54  
55 =back
56  
57 =cut
58  
59 sub pause { $_[0][2]->(); return $_[0] }
60 sub resume { $_[0][3]->(); return $_[0] }
61  
62 =pod
63  
64 Additional methods:
65  
66 =over
67  
68 =item * C<get_unique_bus_name()> - A passthrough to
69 the L<Protocol::DBus::Client> method of the same name.
70  
71 =cut
72  
73 sub get_unique_bus_name {
74 return $_[0]->_dbus()->get_unique_bus_name();
75 }
76  
77 =back
78  
79 =cut
80  
81 #----------------------------------------------------------------------
82  
83 # Undocumented
84 sub new {
85 my ($class, $dbus, $post_send_cr, $pause_cr, $resume_cr) = @_;
86  
87 return bless [$dbus, $post_send_cr, $pause_cr, $resume_cr], $class;
88 }
89  
90 # for testing
91 sub _dbus { $_[0][0] }
92  
93 sub _wrap_send {
94 my ($fn, $self) = @_;
95  
96 my $ret = $self->[0]->$fn( @_[2 .. $#_] );
97  
98 $self->[1]->();
99  
100 return $ret;
101 }
102  
103 1;