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