blib/lib/SMS/API.pm

filter: Statementstmt 63.0% 29 / 46 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 77.7% 7 / 9 Podpod 100% 2 / 2 totaltotal 50.0% 38 / 76 CC 7 SCAR 28.0
CC
7
Cov
48%
send
33.8
new
2.0
BEGIN
1.0
CRAP 16.4
↑ Summary API/t/use.t »
1 package SMS::API;
2
3 #################################################################################
4 #
5 #
6 # SMS1.in Goyali.com webbee.biz eMailOnMove.com
7 #
8 #################################################################################
9 #NOTE: Distributing this script is permitted but requires a licence. Visit www.sms1.in/contact.html for requesting
10 #that . Provide the reason for distributing the script ie. for which application do you want to use the cript. You will be responded within hours.
11 #Disclaimer: This program is distributed as it is and the author or sms1.in does not claim any responsibilities for the successful operation of this program or that we are not sure that it will or can cause any abnormality in your computer. However during our testing no such problem occured.
12 #For a detailed policy visit www.sms1.in/policy.htm
13 #
14 #
15 #This script is Prepared by ,
16 #Abhsihek jain
17 #Chief Programmer
18 #SMS1.in
19 #
20 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23
24 1 require Exporter;
25
26 1 our @ISA = qw(Exporter);
27
28
29 1 our %EXPORT_TAGS = ( 'all' => [ qw(
30
31 ) ] );
32
33 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
34
35 1 our @EXPORT = qw();
36 1 our $VERSION = '4.01.1';
37
38
39 # Preloaded methods go here.
40 1 ▶use HTTP::Request::Common qw(GET);
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 my $ua = LWP::UserAgent->new;
43 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
44 0 my ($self);
45 0 my $class = shift;
46 0 my (%hash) = @_;
47 $self = bless {
48 'email' => $hash{email},
49 'password' => $hash{password},
50 'message' => $hash{message},
51 'from' =>$hash{from},
52 'to' =>$hash{to},
53 0 }, $class;
54 0 return $self;
55 }
56
57 0 ▶sub send{
Subroutine send: not called CC=7 SCAR=35.2
Pod documented
58 0 my $self = shift;
59 0 ▶ if(!$self->{email}||!$self->{password}||!$self->{to}||!$self->{message}){return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"email"} and $self->{"password"} and $self->{"to"} and $self->{"message"}) 0 0 0
Condition0%0/9
$self->{"email"} and $self->{"password"} and $self->{"to"} and $self->{"message"}
!ll&&!rl&&r
000
$self->{"email"} and $self->{"password"} and $self->{"to"}
!ll&&!rl&&r
000
$self->{"email"} and $self->{"password"}
!ll&&!rl&&r
000
MC/DC0%0/4
$self->{"email"} and $self->{"password"} and $self->{"to"} and $self->{"message"}
$self->{"email"} $self->{"password"} $self->{"to"} $self->{"message"}
Truth table0%0/5
A and B and C and D
A= $self->{"email"}B= $self->{"password"}C= $self->{"to"}D= $self->{"message"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
60 0 ▶ if(!$self->{from}){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"from"}) 0 0 0
61 0 $self->{from}='SMS1';
62 }
63 0 $self->{message}=substr $self->{message},0,159;
64 # $self->{messageText}=~ s/\&/\&/gi;
65 # $self->{messageText}=~ s/\</\&lt;/gi;
66 # $self->{messageText}=~ s/\'/\&apos;/gi;
67
68 1 ▶ use HTTP::Request::Common qw(POST);
Subroutine BEGIN: called CC=1 SCAR=0.0
69 1 ▶ use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
70 0 my $ua = LWP::UserAgent->new;
71 0 my $req = HTTP::Request->new(GET => "http://sms1.in/cgi-bin/send.sms?email=".$self->{email}."&password=".$self->{password}."&to=".$self->{to}."&from=".$self->{from}."&message=".$self->{message});
72 0 my $res=$ua->request($req);
73 0 ▶ unless ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($res->is_success) 0 0 0
74 0 return '0';
75 }
76 0 return $res->content;
77 }
78
79 1 1;
80 __END__
↑ Summary API/t/use.t »