line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SMS::Send::Driver;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
SMS::Send::Driver - Base class for SMS::Send drivers
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
The C class provides an abstract base class for all
|
12
|
|
|
|
|
|
|
L driver classes.
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
At this time it does not provide any implementation code for drivers
|
15
|
|
|
|
|
|
|
(although this may change in the future) with the exception of some
|
16
|
|
|
|
|
|
|
methods provided to trigger "does not implement method" errors.
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
However, it does serve as something you should sub-class your driver from
|
19
|
|
|
|
|
|
|
to identify it as a L driver.
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Please note that if your driver class not B return true for
|
22
|
|
|
|
|
|
|
C<$driver->isa('SMS::Send::Driver')> then the L constructor
|
23
|
|
|
|
|
|
|
will refuse to use your class as a driver.
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut
|
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
4
|
|
68
|
use 5.006;
|
|
4
|
|
|
|
|
12
|
|
30
|
4
|
|
|
4
|
|
19
|
use strict;
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
68
|
|
31
|
4
|
|
|
4
|
|
17
|
use Carp ();
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
547
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our $VERSION = '1.07'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The C constructor is required to be implemented by your driver subclass.
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
It recieves a set of arbitrary paired params. The values of these params are
|
42
|
|
|
|
|
|
|
assumed to be driver-specific (this is expected to change).
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
If your driver will need to login to some system, locate hardware, or
|
45
|
|
|
|
|
|
|
do some other form of initialisation to validate the SMS delivery mechanism
|
46
|
|
|
|
|
|
|
exists, it should do so in C.
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Should return a new L-subclass object, or die on error.
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new {
|
53
|
2
|
|
|
2
|
1
|
5
|
my $class = shift;
|
54
|
2
|
|
|
|
|
201
|
Carp::croak("Driver Error: $class does not implement the 'new' constructor");
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 send_sms
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The C method is required to be implemented by your driver subclass.
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
It recieves a set of param pairs as documented in L.
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Should return true for either success or fire-and-forget with unknown result,
|
66
|
|
|
|
|
|
|
defined-but-false ('' or 0) for a failed message send, or die on a fatal error.
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub send_sms {
|
71
|
0
|
|
0
|
0
|
1
|
|
my $class = ref($_[0]) || $_[0];
|
72
|
0
|
|
|
|
|
|
Carp::croak("Driver Error: $class does not implement the 'send_sms' method");
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1;
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=pod
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUPPORT
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Bugs should be reported via the CPAN bug tracker at
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
For other issues, contact the author.
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Copyright 2005 - 2011 Adam Kennedy.
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This program is free software; you can redistribute
|
96
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself.
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The full text of the license can be found in the
|
99
|
|
|
|
|
|
|
LICENSE file included with this module.
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut
|