line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SMS::MunduSMS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22711
|
use 5.008008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
50
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
33
|
|
6
|
1
|
|
|
1
|
|
1385
|
use WWW::Mechanize; |
|
1
|
|
|
|
|
337777
|
|
|
1
|
|
|
|
|
645
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.021'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
1
|
2514
|
my $class = shift; |
12
|
1
|
|
|
|
|
7
|
my %args = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
33
|
|
|
10
|
$class = ref $class || $class; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
5
|
my %params = %args; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
4
|
$params{sms} = []; |
19
|
1
|
|
|
1
|
|
99
|
$params{mech} = WWW::Mechanize->new( onerror => sub { } ); |
|
1
|
|
|
|
|
59
|
|
20
|
1
|
|
|
|
|
28370
|
$params{mech}->agent_alias('Windows IE 6'); |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
104
|
return bless \%params, $class; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _login { |
26
|
1
|
|
|
1
|
|
2037
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
11
|
$self->{mech}->get(q[http://www.mundusms.com/web/Login.aspx]); |
29
|
1
|
|
|
|
|
782112
|
$self->{mech}->form_number(1); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
524
|
map { $_->value( $self->{username} ); } $self->{mech}->find_all_inputs( |
|
0
|
|
|
|
|
0
|
|
32
|
|
|
|
|
|
|
type => 'text', |
33
|
|
|
|
|
|
|
name_regex => qr/user_login$/, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
30
|
map { $_->value( $self->{password} ); } $self->{mech}->find_all_inputs( |
|
0
|
|
|
|
|
0
|
|
37
|
|
|
|
|
|
|
type => 'password', |
38
|
|
|
|
|
|
|
name_regex => qr/user_pass$/, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
30
|
$self->{mech}->submit_form( |
42
|
|
|
|
|
|
|
fields => { |
43
|
|
|
|
|
|
|
'__EVENTARGUMENT' => '', |
44
|
|
|
|
|
|
|
'__EVENTTARGET' => '', |
45
|
|
|
|
|
|
|
'__LASTFOCUS' => '', |
46
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderMasterLogin$button_login.x' => 10, |
47
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderMasterLogin$button_login.y' => 14, |
48
|
|
|
|
|
|
|
'ctl00$dropCulture' => 1 |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
return ( $self->{mech}->uri =~ /UserHome.aspx$/ ) ? 1 : 0; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
|
return 0 unless ( $self->{mech}->find_link( url_regex => qr/sendsms.aspx/i ) && $self->{mech}->follow_link( url_regex => qr/sendsms.aspx/i ) ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub add_sms { |
58
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
59
|
0
|
|
|
|
|
|
my %args = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
push( @{ $self->{sms} }, \%args ); |
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return 1; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub send_sms { |
67
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
$self->{logged_in} = $self->_login unless ( $self->{logged_in} ); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
while ( my $sms = pop( @{ $self->{sms} } ) ) { |
|
0
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
$self->{mech}->follow_link( url_regex => qr/sendsms.aspx/i ) unless ( $self->{mech}->uri =~ /sendsms.aspx/i ); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$self->{mech}->form_number(1); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
map { $_->value( $sms->{to} ); } $self->{mech}->find_all_inputs( |
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
type => 'textarea', |
78
|
|
|
|
|
|
|
name_regex => qr/mobileno$/, |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
map { $_->value( $sms->{message} ); } $self->{mech}->find_all_inputs( |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
type => 'textarea', |
83
|
|
|
|
|
|
|
name_regex => qr/msg$/, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $len = sprintf( '%d characters, %d SMS', length( $sms->{message} ), ( int( length( $sms->{message} ) ) / 160 ) + 1 ); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$self->{mech}->submit_form( |
89
|
|
|
|
|
|
|
fields => { |
90
|
|
|
|
|
|
|
'__EVENTARGUMENT' => '', |
91
|
|
|
|
|
|
|
'__EVENTTARGET' => '', |
92
|
|
|
|
|
|
|
'__LASTFOCUS' => '', |
93
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$button_submit_sms.x' => 15, |
94
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$button_submit_sms.y' => 6, |
95
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$InfoCharCounter' => $len, |
96
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$hiddenCharCount' => $len, |
97
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$Hiddenselected' => 0, |
98
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$HiddenUnicode' => 0, |
99
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$DropDown_groups' => 0, |
100
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$Cal_to_ClientStat' => '', |
101
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$HiddenScheduled_id' => '', |
102
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$Hidden_date' => '', |
103
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$Hidden_time' => '', |
104
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$Drop_repeat' => '', |
105
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$hidden_charcount' => length( $sms->{message} ), |
106
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$txt_date' => '', |
107
|
|
|
|
|
|
|
'ctl00$ContentPlaceHolderContent$txt_time' => '', |
108
|
|
|
|
|
|
|
'hiddenInputToUpdateATBuffer_CommonToolkitScripts' => 0 |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
return 1; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
__END__ |