File: | blib/lib/OpenSRF/Transport/PeerHandle.pm |
Coverage: | 50.0% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package 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 | |||||||
7 | my $peer; | ||||||
8 | |||||||
9 - 13 | =head2 peer_handle( $handle ) Assigns the object that will act as the peer connection handle. =cut | ||||||
14 | sub 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 | ||||||
29 | sub 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 | |||||||
40 | 1; |