YahooMessenger/ReceiveBuddyList.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 46 CC 4 SCAR 22.2
CC
4
Cov
0%
source
20.0
body
2.0
code
2.0
CRAP 9.2
1 package Net::YahooMessenger::ReceiveBuddyList;
2 use base 'Net::YahooMessenger::Event';
3 use strict;
4  
5 use constant YMSG_SEPARATER => "\xC0\x80";
6  
7 sub source {
8 my $self = shift;
9  
10 if (@_) {
11 $self->SUPER::source(@_);
12 my $yahoo = $self->get_connection;
13 my @buddy_list = split( YMSG_SEPARATER, @_[0] );
14 my $group = '';
15 my $next_token = 0;
16 while (@buddy_list) {
17 my $token = shift @buddy_list;
18 if ( $token == 7 ) {
19 my $buddy = shift @buddy_list;
20 $yahoo->add_buddy_by_name( $group, $buddy );
21 }
22 if ( $token == 65 ) {
23 $group = shift @buddy_list;
24 }
25 }
26 }
27 $self->SUPER::source();
28 }
29  
30 sub body {
31 my $self = shift;
32 $self->_get_by_name('BUDDY_LIST');
33 }
34  
35 sub code {
36 return 0x55;
37 }
38  
39 sub to_string {
40 my $self = shift;
41  
42 # sprintf "%s: transit to '%s'", $self->{sender}, $self->{body};
43 }
44  
45 1;
46 __END__