AnySan/Receive.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 49 CC 3 SCAR 15.0
CC
3
Cov
0%
attribute
12.0
new
2.0
provider
2.0
CRAP 4.5
1 package AnySan::Receive;
2 use strict;
3 use warnings;
4  
5 sub new {
6 my($class, %args) = @_;
7 bless { %args }, $class;
8 }
9  
10 sub provider { $_[0]->{provider} }
11 sub event { $_[0]->{event} }
12 sub nickname { $_[0]->{nickname} }
13 sub from_nickname { $_[0]->{from_nickname} }
14 sub message { $_[0]->{message} }
15  
16 sub attribute {
17 my($self, $name, $value) = @_;
18 return $self->{attribute}->{$name} = $value if defined $name && defined $value;
19 return $self->{attribute}->{$name} if defined $name;
20 return $self->{attribute};
21 }
22  
23 sub send_reply {
24 my($self, $message) = @_;
25 $self->{cb}->(
26 reply => $message
27 );
28 }
29  
30 # for backward compatible
31 *send_replay = \&send_reply;
32  
33 1;
34 __END__