[libsms-send-aql-perl] 01/05: Import original source of SMS-Send-AQL 0.03
dom at earth.li
dom at earth.li
Wed Jun 17 09:42:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
dom pushed a commit to branch master
in repository libsms-send-aql-perl.
commit 486e903f5470de1eab2b51ff7960c1a1329ea0ab
Author: Dominic Hargreaves <dom at earth.li>
Date: Wed Jun 17 10:27:57 2015 +0100
Import original source of SMS-Send-AQL 0.03
---
Changes | 17 +++++++
MANIFEST | 10 ++++
META.yml | 19 +++++++
Makefile.PL | 15 ++++++
README | 46 +++++++++++++++++
eg/simple-example.pl | 22 ++++++++
lib/SMS/Send/AQL.pm | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++
t/1-basic.t | 20 ++++++++
t/2-pod.t | 13 +++++
t/3-pod-coverage.t | 13 +++++
10 files changed, 315 insertions(+)
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..cec86af
--- /dev/null
+++ b/Changes
@@ -0,0 +1,17 @@
+Revision history for Perl extension SMS::Send::AQL.
+
+0.04 2011-02-11
+ - Document _login as correct way to supply username
+
+0.03 2008-03-09
+ - Kwalitee-boosting (include META.yml with valid licence)
+
+0.02 2008-01-19
+ - stupidly forgot to declare SMS::Send::Driver as a pre-req
+
+0.01 2008-01-19
+ - original version
+
+
+
+$Id: Changes 280 2008-03-09 01:53:31Z davidp $
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..367c41d
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,10 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+META.yml
+eg/simple-example.pl
+t/1-basic.t
+t/2-pod.t
+t/3-pod-coverage.t
+lib/SMS/Send/AQL.pm
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..4bf3a95
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,19 @@
+--- #YAML:1.0
+ name: SMS-Send-AQL
+ abstract: SMS::Send driver to send messages via AQL (www.aql.com)
+ version: 0.03
+ author:
+ - David Precious <davidp at preshweb.co.uk>
+ license: perl
+ distribution_type: module
+ requires:
+ SMS::AQL: 0
+ SMS::Send::Driver: 0
+ perl: 5.005
+ build_requires:
+ Test: 0
+ meta-spec:
+ version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ generated_by: hand
+
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..4526f2c
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,15 @@
+use 5.008000;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ NAME => 'SMS::Send::AQL',
+ VERSION_FROM => 'lib/SMS/Send/AQL.pm',
+ PREREQ_PM => { SMS::AQL => 0, SMS::Send::Driver => 0 },
+ NO_META => 1,
+ ($] >= 5.005 ? ## Add these new keywords supported since 5.005
+ (ABSTRACT_FROM => 'lib/SMS/Send/AQL.pm',
+ AUTHOR => 'David Precious <davidp at preshweb.co.uk>') : ()),
+);
+
+# $Id: Makefile.PL 280 2008-03-09 01:53:31Z davidp $
diff --git a/README b/README
new file mode 100644
index 0000000..0bdbe71
--- /dev/null
+++ b/README
@@ -0,0 +1,46 @@
+SMS::Send::AQL README
+===========================
+
+An SMS::Send driver to send messages via AQL (www.aql.com).
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+ SMS::AQL
+
+
+USAGE
+
+Please see the documentation for SMS::Send for details on how to use SMS::Send
+to send messages using an SMS::Send driver such as this one.
+
+When creating an instance of SMS::Send, you must supply your AQL account
+username and password, in the parameters _username and _password (alternatively,
+_login can be used in place of _username, for consistency with the example
+provided by SMS::Send).
+
+There is a simple example usage script distributed with SMS::Send::AQL which
+you will find in eg/simple-example.pl.
+
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008 by David Precious
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.0 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+$Id: README 213 2008-01-19 15:32:33Z davidp $
diff --git a/eg/simple-example.pl b/eg/simple-example.pl
new file mode 100755
index 0000000..d0fc835
--- /dev/null
+++ b/eg/simple-example.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+# $Id: simple-example.pl 211 2008-01-19 15:30:31Z davidp $
+#
+# A very quick and simple usage example for SMS::Send::AQL
+
+use strict;
+use SMS::Send;
+
+
+my $sender = SMS::Send->new('AQL', _username => 'user', _password => 'pass');
+
+if (!$sender) {
+ die "Failed to create instance of SMS::Send using SMS::Send::AQL driver";
+}
+
+
+$sender->send_sms(
+ to => '+447734123456',
+ text => 'Text message content here',
+) or die "Failed to send message";
+
diff --git a/lib/SMS/Send/AQL.pm b/lib/SMS/Send/AQL.pm
new file mode 100644
index 0000000..d60178e
--- /dev/null
+++ b/lib/SMS/Send/AQL.pm
@@ -0,0 +1,140 @@
+package SMS::Send::AQL;
+
+# $Id: AQL.pm 281 2008-03-09 01:54:50Z davidp $
+
+use strict;
+use warnings;
+use SMS::AQL;
+our $VERSION = '0.04';
+use base 'SMS::Send::Driver';
+
+
+
+
+=head1 NAME
+
+SMS::Send::AQL - SMS::Send driver to send messages via AQL (www.aql.com)
+
+=head1 SYNOPSIS
+
+ use SMS::Send;
+
+ # Create a sender
+ my $sender = SMS::Send->new('AQL',
+ _login => 'your_aql_username',
+ _password => 'your_aql_password',
+ _sender => 'sender number',
+ );
+
+ # Send a message
+ my $sent = $sender->send_sms(
+ text => 'This is a test message',
+ to => '+61 (4) 1234 5678',
+ );
+
+ if ( $sent ) {
+ print "Message sent ok\n";
+ } else {
+ print "Failed to send message\n";
+ }
+
+
+=head1 DESCRIPTION
+
+A driver for SMS::Send to send SMS text messages via AQL (www.aql.com)
+
+This is not intended to be used directly, but instead called by SMS::Send
+(see synopsis above for a basic illustration, and see SMS::Send's documentation
+for further information).
+
+
+
+=head1 METHODS
+
+=over 4
+
+=item new
+
+Constructor, takes argument pairs passed by SMS::Send, returns an SMS::Send::AQL
+object. See usage synopsis for example, and see SMS::Send documentation for
+further info on using SMS::Send drivers.
+
+=cut
+
+sub new {
+
+ my ($class, %args) = @_;
+
+ my $self = bless { %args }, $class;
+
+ # Previous versions of this module documented _username as the param name
+ # for the username; unfortunately there's no "standard" for SMS::Send
+ # drivers, but the general concensus seems to be to use _login, but we'll
+ # continue to support _username too.
+ if (!exists $args{_login} && exists $args{_username}) {
+ $args{_login} = delete $args{_username};
+ }
+
+ if (grep { ! $args{$_} } qw(_login _password)) {
+ die "_login (or _username) and _password required";
+ }
+
+
+
+ $self->{aql} = new SMS::AQL({
+ username => $args{_login},
+ password => $args{_password},
+ options => {
+ sender => $args{_sender} || 'SMS::AQL',
+ },
+ });
+
+ return $self;
+
+}
+
+
+
+=item send_sms
+
+Send the message - see SMS::Send for details.
+
+=cut
+
+sub send_sms {
+
+ my ($self, %args) = @_;
+
+ # AQL's gateway won't accept numbers in the format +441234567890,
+ # it wants to see 00441234567890 instead:
+ $args{to} =~ s/^\+/00/;
+
+
+ return $self->{aql}->send_sms(@args{ qw (to text) });
+
+}
+
+
+
+=back
+
+=head1 AUTHOR
+
+David Precious, E<lt>davidp at preshweb.co.ukE<gt>
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2008-2011 by David Precious
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.7 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut
+
+
+
+1;
+__END__
diff --git a/t/1-basic.t b/t/1-basic.t
new file mode 100644
index 0000000..555d74b
--- /dev/null
+++ b/t/1-basic.t
@@ -0,0 +1,20 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl 1-basic.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test::More tests => 1;
+BEGIN { use_ok('SMS::Send::AQL') };
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
+
+# TODO: Add more tests (although this is a very simple module)
+
+
+
diff --git a/t/2-pod.t b/t/2-pod.t
new file mode 100644
index 0000000..60f36bd
--- /dev/null
+++ b/t/2-pod.t
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+# Test POD correctness for Finance::PremiumBonds
+#
+# $Id: 2-pod.t 212 2008-01-19 15:31:33Z davidp $
+
+use strict;
+use Test::More;
+
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
+
diff --git a/t/3-pod-coverage.t b/t/3-pod-coverage.t
new file mode 100644
index 0000000..4ebe9b9
--- /dev/null
+++ b/t/3-pod-coverage.t
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+# Test POD coverage for Finance::PremiumBonds
+#
+# $Id: 3-pod-coverage.t 212 2008-01-19 15:31:33Z davidp $
+
+
+use strict;
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage"
+ if $@;
+all_pod_coverage_ok();
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libsms-send-aql-perl.git
More information about the Pkg-perl-cvs-commits
mailing list