YMSG/GoesOffline.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 3 SCAR 18.4
CC
3
Cov
0%
source
12.0
from
2.0
to_string
2.0
CRAP 6.3
1 package Net::YMSG::GoesOffline;
2 use base 'Net::YMSG::Event';
3 use strict;
4  
5  
6 sub source
7 {
8 my $self = shift;
9 if (@_) {
10 $self->SUPER::source(@_);
11 my $yahoo = $self->get_connection;
12 my ($buddy) = grep {
13 $_->name eq lc $self->from
14 } $yahoo->buddy_list;
15 return unless $buddy;
16  
17 $buddy->online(undef);
18 }
19 $self->SUPER::source();
20 }
21  
22  
23 sub from
24 {
25 my $self = shift;
26 $self->_get_by_name('BUDDY_ID');
27 }
28  
29 sub to_string
30 {
31 my $self = shift;
32 sprintf "%s: goes offline", $self->{sender};
33 }
34  
35 1;
36 __END__