| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SMS::Send::AU::Test; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
SMS::Send::AU::Test - SMS::Send Regional-Class Testing Driver |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Create a testing sender |
|
12
|
|
|
|
|
|
|
my $send = SMS::Send->new( 'AU-Test' ); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Clear the message trap |
|
15
|
|
|
|
|
|
|
$send->clear; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Send a message |
|
18
|
|
|
|
|
|
|
$send->send_sms( |
|
19
|
|
|
|
|
|
|
text => 'Hi there', |
|
20
|
|
|
|
|
|
|
to => '+61 (4) 1234 5678', |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Get the message from the trap |
|
24
|
|
|
|
|
|
|
my @messages = $send->messages; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
L supports two classes of drivers. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
An international class named in the format C, which only |
|
31
|
|
|
|
|
|
|
accept international numbers in C<+1 XXX XXXXX> format, and |
|
32
|
|
|
|
|
|
|
regional-context drivers in the format C which will |
|
33
|
|
|
|
|
|
|
also accept a non-leading-plus number in the format applicable within that |
|
34
|
|
|
|
|
|
|
region (in the above case, Australia). |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
L is the testing driver for the regional class of |
|
37
|
|
|
|
|
|
|
drivers. Except for the name, it is otherwise identical to |
|
38
|
|
|
|
|
|
|
L. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Its two roles are firstly to always exist (be installed) and secondly |
|
41
|
|
|
|
|
|
|
to act as a "trap" for messages. Messages sent via SMS::Send::AU::Test |
|
42
|
|
|
|
|
|
|
always succeed, and the messages can be recovered for testing after |
|
43
|
|
|
|
|
|
|
sending. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Note that the trap is done on a per-driver-handle basis, and is not |
|
46
|
|
|
|
|
|
|
shared between multiple driver handles. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
2
|
|
|
2
|
|
1274
|
use 5.006; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
85
|
|
|
51
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
60
|
|
|
52
|
2
|
|
|
2
|
|
11
|
use SMS::Send::Driver (); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
55
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
|
|
2
|
|
10
|
use vars qw{$VERSION @ISA}; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
129
|
|
|
55
|
|
|
|
|
|
|
BEGIN { |
|
56
|
2
|
|
|
2
|
|
12
|
$VERSION = '0.06'; |
|
57
|
2
|
|
|
|
|
394
|
@ISA = 'SMS::Send::Driver'; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
##################################################################### |
|
65
|
|
|
|
|
|
|
# Constructor |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub new { |
|
68
|
1
|
|
|
1
|
1
|
2
|
my $class = shift; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Create the object |
|
71
|
1
|
|
|
|
|
4
|
my $self = bless { |
|
72
|
|
|
|
|
|
|
messages => [], |
|
73
|
|
|
|
|
|
|
}, $class; |
|
74
|
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
3
|
$self; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub send_sms { |
|
79
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
80
|
0
|
|
|
|
|
0
|
my $messages = $self->{messages}; |
|
81
|
0
|
|
|
|
|
0
|
push @$messages, [ @_ ]; |
|
82
|
0
|
|
|
|
|
0
|
return 1; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 METHODS |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
SMS::Send::AU::Test inherits all the methods of the parent L |
|
90
|
|
|
|
|
|
|
class, and adds the following. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 messages |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The C method retrieves as a list all of the messages in the |
|
95
|
|
|
|
|
|
|
message trap. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub messages { |
|
100
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
101
|
0
|
|
|
|
|
0
|
return @{$self->{messages}}; |
|
|
0
|
|
|
|
|
0
|
|
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=pod |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 clear |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
The C method clears the message trap. This should be done before |
|
109
|
|
|
|
|
|
|
each chunk of test code to ensure you are starting from a known state. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns true as a convenience. |
|
112
|
|
|
|
|
|
|
=cut |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub clear { |
|
115
|
1
|
|
|
1
|
1
|
703
|
my $self = shift; |
|
116
|
1
|
|
|
|
|
3
|
$self->{messages} = [ ]; |
|
117
|
1
|
|
|
|
|
5
|
return 1; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 SUPPORT |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Bugs should be reported via the CPAN bug tracker at |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
For other issues, contact the author. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHOR |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Copyright 2005 - 2011 Adam Kennedy. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
141
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
144
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |