line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SMS::Mollie; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
120103
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
104
|
|
4
|
3
|
|
|
3
|
|
16
|
use Carp; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
255
|
|
5
|
3
|
|
|
3
|
|
26351
|
use LWP::UserAgent; |
|
3
|
|
|
|
|
294634
|
|
|
3
|
|
|
|
|
120
|
|
6
|
3
|
|
|
3
|
|
5441
|
use XML::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
9
|
|
|
|
|
|
|
our (@ISA) = qw(Exporter); |
10
|
|
|
|
|
|
|
our (@EXPORT) = qw(send_sms); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
|
|
|
|
|
|
my ($class, %params) = @_; |
14
|
|
|
|
|
|
|
my $self = {}; |
15
|
|
|
|
|
|
|
bless $self, $class; |
16
|
|
|
|
|
|
|
$self->_init(%params) or return undef; |
17
|
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub send_sms { |
21
|
|
|
|
|
|
|
return __PACKAGE__->new( |
22
|
|
|
|
|
|
|
username => $_[0], |
23
|
|
|
|
|
|
|
password => $_[1], |
24
|
|
|
|
|
|
|
recipients=> [$_[2]], |
25
|
|
|
|
|
|
|
originator=> $_[4] || 'Mollie', |
26
|
|
|
|
|
|
|
)->send($_[3]); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub baseurl { |
30
|
|
|
|
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
if (@_) { $self->{"_baseurl"} = shift } |
32
|
|
|
|
|
|
|
return $self->{"_baseurl"}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub ua { |
36
|
|
|
|
|
|
|
my $self = shift; |
37
|
|
|
|
|
|
|
if (@_) { $self->{"_ua"} = shift } |
38
|
|
|
|
|
|
|
return $self->{"_ua"}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub gateway { |
42
|
|
|
|
|
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
if (@_) { $self->{"_gateway"} = shift } |
44
|
|
|
|
|
|
|
return $self->{"_gateway"}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub originator { |
48
|
|
|
|
|
|
|
my $self = shift; |
49
|
|
|
|
|
|
|
if (@_) { $self->{"_originator"} = shift } |
50
|
|
|
|
|
|
|
return $self->{"_originator"}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub username { |
54
|
|
|
|
|
|
|
my $self = shift; |
55
|
|
|
|
|
|
|
if (@_) { $self->{"_username"} = shift } |
56
|
|
|
|
|
|
|
return $self->{"_username"}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub password { |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
if (@_) { $self->{"_password"} = shift } |
62
|
|
|
|
|
|
|
return $self->{"_password"}; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub login { |
66
|
|
|
|
|
|
|
my ($self, $user, $pass) = @_; |
67
|
|
|
|
|
|
|
$self->username($user) if($user); |
68
|
|
|
|
|
|
|
$self->password($pass) if($pass); |
69
|
|
|
|
|
|
|
return ($self->username, $self->password); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub recipient { |
73
|
|
|
|
|
|
|
my ($self, $recip) = @_; |
74
|
|
|
|
|
|
|
push @{$self->{"_recipients"}}, $recip if($recip); |
75
|
|
|
|
|
|
|
return $self->{"_recipients"}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub message { |
79
|
|
|
|
|
|
|
my $self = shift; |
80
|
|
|
|
|
|
|
if (@_) { $self->{"_message"} = shift } |
81
|
|
|
|
|
|
|
return $self->{"_message"}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub deliverydate { |
85
|
|
|
|
|
|
|
my $self = shift; |
86
|
|
|
|
|
|
|
if (@_) { $self->{"_deliverydate"} = shift } |
87
|
|
|
|
|
|
|
return $self->{"_deliverydate"}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub type { |
91
|
|
|
|
|
|
|
my $self = shift; |
92
|
|
|
|
|
|
|
if (@_) { $self->{"_type"} = shift } |
93
|
|
|
|
|
|
|
return $self->{"_type"}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub url { |
97
|
|
|
|
|
|
|
my $self = shift; |
98
|
|
|
|
|
|
|
if (@_) { $self->{"_url"} = shift } |
99
|
|
|
|
|
|
|
return $self->{"_url"}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub udh { |
103
|
|
|
|
|
|
|
my $self = shift; |
104
|
|
|
|
|
|
|
if (@_) { $self->{"_udh"} = shift } |
105
|
|
|
|
|
|
|
return $self->{"_udh"}; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub is_success { |
109
|
|
|
|
|
|
|
my $self = shift; |
110
|
|
|
|
|
|
|
return $self->{"_success"}; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub successcount { |
114
|
|
|
|
|
|
|
my $self = shift; |
115
|
|
|
|
|
|
|
return $self->{"_successcount"}; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub resultcode { |
119
|
|
|
|
|
|
|
my $self = shift; |
120
|
|
|
|
|
|
|
return $self->{"_resultcode"}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub resultmessage { |
124
|
|
|
|
|
|
|
my $self = shift; |
125
|
|
|
|
|
|
|
return $self->{"_resultmessage"}; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub send { |
129
|
|
|
|
|
|
|
my ($self, $message) = @_; |
130
|
|
|
|
|
|
|
$self->message($message) if($message); |
131
|
|
|
|
|
|
|
my $parms = {}; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# Wappush? We must have gateway 1 and an URL |
134
|
|
|
|
|
|
|
if($self->type eq 'wappush') { |
135
|
|
|
|
|
|
|
$self->gateway(1) ; |
136
|
|
|
|
|
|
|
$self->_croak("No url specified.") unless($self->url); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
#### Check for mandatory input |
140
|
|
|
|
|
|
|
foreach(qw/username password gateway originator recipients message type/) { |
141
|
|
|
|
|
|
|
$self->_croak("$_ not specified.") unless(defined $self->{"_$_"}); |
142
|
|
|
|
|
|
|
if($_ eq 'recipients') { |
143
|
|
|
|
|
|
|
$parms->{$_} = join(",", @{$self->{"_$_"}}); |
144
|
|
|
|
|
|
|
} else { |
145
|
|
|
|
|
|
|
$parms->{$_} = $self->{"_$_"}; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
#### Check for some specific input |
150
|
|
|
|
|
|
|
# Gateway is either 1, or 2 |
151
|
|
|
|
|
|
|
$self->_croak("Gateway should be either '1' or '2'") |
152
|
|
|
|
|
|
|
unless($self->gateway == 1 || $self->gateway == 2); |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
# Type can be normaal/wappush/vcard/flash/binary/long |
155
|
|
|
|
|
|
|
$self->_croak("Invalid type") |
156
|
|
|
|
|
|
|
unless($self->type =~ /^(normaal|wappush|vcard|flash|binary|long)$/); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# Append the additional arguments |
159
|
|
|
|
|
|
|
foreach(qw/deliverydate url udh/) { |
160
|
|
|
|
|
|
|
$parms->{$_} = $self->{"_$_"} if(defined $self->{"_$_"}); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# Should be ok now, right? Let's send it! |
164
|
|
|
|
|
|
|
my $res = $self->{"_ua"}->post($self->baseurl, $parms); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
if($res->is_success) { |
167
|
|
|
|
|
|
|
my $item = _parse_output($res->decoded_content)->{'item'}; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# Set the return info |
170
|
|
|
|
|
|
|
$self->{"_resultcode"} = $item->{"resultcode"}; |
171
|
|
|
|
|
|
|
$self->{"_resultmessage"} = $item->{"resultmessage"}; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
# Successful? |
174
|
|
|
|
|
|
|
if($item->{"success"} eq 'false') { |
175
|
|
|
|
|
|
|
$self->{"_successcount"} = 0; |
176
|
|
|
|
|
|
|
$self->{"_success"} = 0; |
177
|
|
|
|
|
|
|
} else { |
178
|
|
|
|
|
|
|
$self->{"_successcount"} = $item->{'recipients'}; |
179
|
|
|
|
|
|
|
$self->{"_success"} = 1; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} else { |
182
|
|
|
|
|
|
|
$self->{"_resultcode"} = -1; |
183
|
|
|
|
|
|
|
$self->{"_resultmessage"} = $res->status_line; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
return $self->is_success; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub credits { |
189
|
|
|
|
|
|
|
my $self = shift; |
190
|
|
|
|
|
|
|
my $parms = {}; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
foreach(qw/username password/) { |
193
|
|
|
|
|
|
|
$self->_croak("$_ must be defined!") unless(defined $self->{"_$_"}); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
$parms->{'gebruikersnaam'} = $self->{"_username"}; |
197
|
|
|
|
|
|
|
$parms->{'wachtwoord'} = $self->{"_password"}; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
my $res = $self->{"_ua"}->post($self->{"_creditsurl"}, $parms); |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
if($res->is_success) { |
202
|
|
|
|
|
|
|
if($res->decoded_content eq 'ERROR') { |
203
|
|
|
|
|
|
|
$self->{"_resultcode"} = -2; |
204
|
|
|
|
|
|
|
$self->{"_resultmessage"} = "Username or password incorrect"; |
205
|
|
|
|
|
|
|
} else { |
206
|
|
|
|
|
|
|
return $res->decoded_content; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
} else { |
209
|
|
|
|
|
|
|
$self->{"_resultcode"} = -1; |
210
|
|
|
|
|
|
|
$self->{"_resultmessage"} = $res->status_line; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
return undef; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
#################################################################### |
216
|
|
|
|
|
|
|
sub _init { |
217
|
|
|
|
|
|
|
my $self = shift; |
218
|
|
|
|
|
|
|
my %params = @_; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my $ua = LWP::UserAgent->new( |
221
|
|
|
|
|
|
|
agent => __PACKAGE__." v. $VERSION", |
222
|
|
|
|
|
|
|
); |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# Set/override defaults |
225
|
|
|
|
|
|
|
my %options = ( |
226
|
|
|
|
|
|
|
ua => $ua, |
227
|
|
|
|
|
|
|
baseurl => 'https://secure.mollie.nl/xml/sms/', |
228
|
|
|
|
|
|
|
creditsurl => 'http://www.mollie.nl/partners/api/smscredits/', |
229
|
|
|
|
|
|
|
gateway => 1, |
230
|
|
|
|
|
|
|
originator => 'Mollie', |
231
|
|
|
|
|
|
|
username => undef, |
232
|
|
|
|
|
|
|
password => undef, |
233
|
|
|
|
|
|
|
recipients => [], |
234
|
|
|
|
|
|
|
message => undef, |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
deliverydate => undef, |
237
|
|
|
|
|
|
|
type => 'normaal', |
238
|
|
|
|
|
|
|
url => undef, |
239
|
|
|
|
|
|
|
udh => undef, |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
success => undef, |
242
|
|
|
|
|
|
|
successcount => undef, |
243
|
|
|
|
|
|
|
resultcode => undef, |
244
|
|
|
|
|
|
|
resultmessage => undef, |
245
|
|
|
|
|
|
|
%params, |
246
|
|
|
|
|
|
|
); |
247
|
|
|
|
|
|
|
$self->{"_$_"} = $options{$_} foreach(keys %options); |
248
|
|
|
|
|
|
|
return $self; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub _parse_output { |
252
|
|
|
|
|
|
|
my $input = shift; |
253
|
|
|
|
|
|
|
return unless($input); |
254
|
|
|
|
|
|
|
my $xso = new XML::Simple(); |
255
|
|
|
|
|
|
|
return $xso->XMLin($input); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub _croak { |
259
|
|
|
|
|
|
|
my ($self, @error) = @_; |
260
|
|
|
|
|
|
|
Carp::croak(@error); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
#################### main pod documentation begin ################### |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head1 NAME |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
Net::SMS::Mollie - Send SMS messages via the mollie.nl service |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head1 SYNOPSIS |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
use strict; |
271
|
|
|
|
|
|
|
use Net::SMS::Mollie; |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
my $mollie = new Net::SMS::Mollie; |
274
|
|
|
|
|
|
|
$mollie->login('username', 'p4ssw0rd'); |
275
|
|
|
|
|
|
|
$mollie->recipient('0612345678'); |
276
|
|
|
|
|
|
|
$mollie->send("I can send SMS!"); |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
if($mollie->is_success) { |
279
|
|
|
|
|
|
|
print "Successfully sent message to ".$mollie->successcount." number(s)!"; |
280
|
|
|
|
|
|
|
} else { |
281
|
|
|
|
|
|
|
print "Something went horribly wrong!\n". |
282
|
|
|
|
|
|
|
"Error: ".$mollie->resultmessage." (".$mollie->resultcode.")"; |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
or, if you like one liners: |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
perl -MNet::SMS::Mollie -e 'send_sms("username", "password", "recipient", "text", "originator")' |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head1 DESCRIPTION |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
C allows sending SMS messages via L |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 METHODS |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head2 new |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
C creates a new C object. |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head3 options |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=over 5 |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item baseurl |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Defaults to L, but could be set to, |
306
|
|
|
|
|
|
|
for example, the non SSL URL L. |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=item ua |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Configure your own L object, or use our default one. |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=item gateway |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
Defaults to gateway "1". For more information on the mollie.nl gateways, |
315
|
|
|
|
|
|
|
please read L |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item originator |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
The sender of the SMS. Could be 14 digits or 11 characters. Defaults to |
320
|
|
|
|
|
|
|
"Mollie", so you most likely do want to override this default. |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=item username |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
Your mollie.nl username |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=item password |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Your mollie.nl password |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=item recipients |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Takes an array of phonenumbers to send the message to. |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=item message |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
The actual SMS text |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=item type |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
Defaults to I, but could be set to I
|
341
|
|
|
|
|
|
|
binary, or long> |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item deliverydate |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
C When do you want to send the SMS? Format: I |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=item url |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
C Only useful for the I type. Specify the URL of the |
350
|
|
|
|
|
|
|
wappush content. |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=item udh |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
C Only useful for the I type. Specify the I |
355
|
|
|
|
|
|
|
the SMS message. |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=back |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
All these options can be set at creation time, or be set later, like this: |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
$mollie->username('my_username'); |
362
|
|
|
|
|
|
|
$mollie->password('my_password'); |
363
|
|
|
|
|
|
|
$mollie->type('wappush'); |
364
|
|
|
|
|
|
|
$mollie->url('some_url'); |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
Without an argument, the method will return its current value: |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
my $username = $mollie->username; |
369
|
|
|
|
|
|
|
my $baseurl = $mollie->baseurl; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=head2 login |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
Set the I and I in one go. |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
$mollie->login('my_username', 'my_p4ssw0rd'); |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
# is basically a shortcut for |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
$mollie->username('my_username'); |
380
|
|
|
|
|
|
|
$mollie->password('my_p4ssw0rd'); |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
Without arguments, it will return the array containing I, |
383
|
|
|
|
|
|
|
and I. |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
my ($user, $pass) = $mollie->login; |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=head2 recipient |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
Push numbers in the I array |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
foreach(qw/1234567890 0987654321 1292054283/) { |
392
|
|
|
|
|
|
|
$mollie->recipient($_); |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=head2 send |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Send the actual message. If this method is called with an argument, |
398
|
|
|
|
|
|
|
it's considered the I. Returns true if the sending was successful, |
399
|
|
|
|
|
|
|
and false when the sending failed (see I and I). |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=head2 is_success |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
Returns true when the last sending was successful and false when it failed. |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=head2 successcount |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Returns the amount of messages actually sent (could be useful with multiple |
408
|
|
|
|
|
|
|
recipients). |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=head2 resultcode |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
Returns the resulting code, as provided by mollie.nl. See |
413
|
|
|
|
|
|
|
L for all possible codes. |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
When L reports an error, the I will be |
416
|
|
|
|
|
|
|
set to C<-1>. |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=head2 resultmessage |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
Returns the result message, as provided by mollie.nl, or L. |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=head2 credits |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
Requires both I and I to be set, and returns the |
425
|
|
|
|
|
|
|
amount of remaining credits (with 4 decimals) or I: |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
if(my $credits = $mollie->credits) { |
428
|
|
|
|
|
|
|
print $credits." credits left!\n"; |
429
|
|
|
|
|
|
|
} else { |
430
|
|
|
|
|
|
|
print $mollie->resultmessage." (". |
431
|
|
|
|
|
|
|
$mollie->resultcode.")\n"; |
432
|
|
|
|
|
|
|
} |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=head1 SEE ALSO |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=over 5 |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
=item * L |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=item * L |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=back |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=head1 BUGS |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
Please report any bugs to L |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=head1 AUTHOR |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
M. Blom, |
451
|
|
|
|
|
|
|
Eblom@cpan.orgE, |
452
|
|
|
|
|
|
|
L |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=head1 COPYRIGHT |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
This program is free software; you can redistribute |
457
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
The full text of the license can be found in the |
460
|
|
|
|
|
|
|
LICENSE file included with this module. |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=cut |
463
|
|
|
|
|
|
|
#################### main pod documentation end ################### |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
1; |