YahooMessenger/ReceiveMessage.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 51 CC 7 SCAR 22.5
CC
7
Cov
0%
source
12.0
from
12.0
body
12.0
CRAP 9.5
1 package Net::YahooMessenger::ReceiveMessage;
2 use base 'Net::YahooMessenger::Event';
3  
4 sub source {
5 my $self = shift;
6 if (@_) {
7 $self->{source} = shift;
8 my $code = $self->_get_by_name('STATUS_CODE') || 0;
9 if ( $code == 99 ) {
10 require Net::YahooMessenger::NullEvent;
11 bless $self, 'Net::YahooMessenger::NullEvent';
12 }
13 }
14 $self->{source};
15 }
16  
17 sub from {
18 my $self = shift;
19 $self->_set_by_name( 'RECV_FROM', shift ) if @_;
20 if ( $self->_get_by_name('ERROR_MESSAGE') ) {
21 return 'system';
22 }
23 $self->_get_by_name('RECV_FROM');
24 }
25  
26 sub body {
27 my $self = shift;
28 $self->_set_by_name( 'MESSAGE', shift ) if @_;
29 if ( $self->_get_by_name('ERROR_MESSAGE') ) {
30 return $self->_get_by_name('ERROR_MESSAGE');
31 }
32 $self->_get_by_name('MESSAGE');
33 }
34  
35 sub to_string {
36 my $self = shift;
37 sprintf "%s: %s", $self->{sender}, $self->{body};
38 }
39  
40 1;
41 __END__