File Coverage

File:blib/lib/OpenSRF/Transport/PeerHandle.pm
Coverage:50.0%

linestmtbrancondsubpodtimecode
1package OpenSRF::Transport::PeerHandle;
2
9
9
9
50
38
66
use OpenSRF::Utils::Logger qw(:level);
3
9
9
9
63
35
59
use OpenSRF::EX;
4
9
9
9
68
40
64
use base qw/OpenSRF::Transport::SlimJabber::PeerConnection/;
5
9
9
9
73
33
1217
use vars '@ISA';
6
7my $peer;
8
9 - 13
=head2 peer_handle( $handle )

Assigns the object that will act as the peer connection handle.

=cut
14sub peer_handle {
15
0
1
        my( $class, $handle ) = @_;
16
0
0
        if( $handle ) { $peer = $handle; }
17
0
        return $peer;
18}
19
20
21 - 28
=head2 set_peer_client( $peer )

Sets the class that will act as the superclass of this class.
Pass in a string representing the module to be used as the superclass,
and that module is 'used' and unshifted into @ISA.  We now have that
classes capabilities.  

=cut
29sub set_peer_client {
30
0
1
        my( $class, $peer ) = @_;
31
0
        if( $peer ) {
32
0
                $peer->use;
33
0
                if( $@ ) {
34
0
                        throw OpenSRF::EX::PANIC ( "Unable to set peer client: $@" );
35                }
36
0
                unshift @ISA, $peer;
37        }
38}
39
401;