File Coverage

blib/lib/SMS/Send/ClickSend.pm
Criterion Covered Total %
statement 16 27 59.2
branch 0 4 0.0
condition n/a
subroutine 6 8 75.0
pod 2 2 100.0
total 24 41 58.5


line stmt bran cond sub pod time code
1             package SMS::Send::ClickSend;
2              
3 1     1   15429 use strict;
  1         1  
  1         34  
4 1     1   15 use 5.008_005;
  1         3  
  1         40  
5             our $VERSION = '0.01';
6              
7 1     1   462 use SMS::Send::Driver ();
  1         280  
  1         17  
8 1     1   385 use SMS::ClickSend;
  1         46551  
  1         30  
9              
10 1     1   6 use vars qw{@ISA};
  1         1  
  1         43  
11             BEGIN {
12 1     1   162 @ISA = 'SMS::Send::Driver';
13             }
14              
15             sub new {
16 0     0 1   my $pkg = shift;
17 0           my %p = @_;
18 0           my $self = bless \%p, $pkg;
19 0           $self->{_clicksend} = SMS::ClickSend->new({
20             username => $p{_username},
21             api_key => $p{_api_key}
22             });
23 0           return $self;
24             }
25              
26             sub send_sms {
27 0     0 1   my $self = shift;
28 0           my %p = @_;
29              
30 0           $p{message} = delete $p{text};
31 0 0         my $sms = $self->{_clicksend}->send(\%p) or return 0;
32              
33 0 0         return 0 unless $sms->{messages}->[0]->{result} eq '0000';
34 0           return 1;
35             }
36              
37             1;
38             __END__