SMS::Send(3pm)

πŸ“¦
version 1.07 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’Œ SMS::Send β€” the driver-based API for sending SMS, bestie

okay so real talk, this is SMS::Send, a Perl module, and it's here to give you ONE api for sending SMS and MMS messages. one. that's the whole vibe. ✨


🌸 SYNOPSIS

# Create a sender
my $sender = SMS::Send->new('SomeDriver',
    _login    => 'myname',
    _password => 'mypassword',
);

# Send a message
my $sent = $sender->send_sms(
    text => 'This is a test message',
    to   => '+61 (4) 1234 5678',
);

# Did the send succeed.
if ( $sent ) {
    print "Message sent ok\n";
} else {
    print "Failed to send message\n";
}

πŸ¦‹ DESCRIPTION

so "SMS::Send" is intended to be a driver-based single API for sending SMS and MMS messages. the whole point is that you get one API to write your code against when you wanna send an SMS. that's it. that's the dream. πŸ’…

and ALSO, it wants to remove the limits of some of the previous attempts at this sort of API β€” like the whole "must be free internet-based SMS services" thing. not me being trapped by that, no ma'am. πŸ™…β™€οΈ

"SMS::Send" drivers are installed separately, and they might use the web, email, or physical SMS hardware. could be free, could be paid. the details shouldn't matter. fr fr. 🫢

you should not have to care how it is actually sent, only that it has been sent β€” although, lowkey, some drivers may not be able to provide certainty. 🫠


πŸ‘‘ METHODS

✨ installed_drivers

the "installed_drivers" gives you the list of SMS::Send drivers that are installed on the current system. that's it, that's the tea. πŸ“

✨ new

# The most basic sender
$sender = SMS::Send->new('Test');

# Indicate regional driver with ::
$sender = SMS::Send->new('AU::Test');

# Pass arbitrary params to the driver
$sender = SMS::Send->new('MyDriver',
    _login    => 'adam',
    _password => 'adam',
);

the "new" constructor creates a new SMS sender. main character energy, obviously. πŸ’…

it takes as its first parameter a driver name. these names map the class names. for example driver "Test" matches the testing driver SMS::Send::Test. periodt.

any additional params should be key/value pairs, split into two types:

  • params without a leading underscore are "public" options and relate to standardised features within the SMS::Send API itself. at this time, there are no usable public options. 😭
  • params with a leading underscore are "private" driver-specific options and will be passed through to the driver unchanged. no touchy. πŸ™ˆ

returns a new SMS::Send object, or dies on error. πŸ’€

✨ send_sms

# Send a message to a particular address
my $result = $sender->send_sms(
    text => 'This is a test message',
    to   => '+61 4 1234 5678',
);

the "send_sms" method sends a standard text SMS message to a destination phone number. πŸŽ€

it takes a set of named parameters to describe the message and its destination, again split into two types.

params without a leading underscore are "public" options and relate to standardised features within the SMS::Send API itself.

🌟 text

the "text" param is compulsory and should be a plain text string of non-zero length. the maximum length is currently determined by the driver, and exceeding this length will result in an exception being thrown if you breach it. so like, don't. 😀

better functionality for determining the maximum-supported length is expected in the future. you input would be welcome. (yes, that's what it says β€” your input is wanted, bestie! 🫢)

🌟 to

the "to" param is compulsory, and should be an international phone number as indicated by a leading plus "+" character. punctuation in any form is allowed, and will be stripped out before it is provided to the driver. so go ahead and format it cute, it gets cleaned up. ✨

if and only if your driver is a regional driver (as indicated by a ::-seperated name such as AU::Test) the "to" number can also be in a regional-specific dialing format, "without" a leading plus "+" character.

providing a regional number to a non-regional driver will throw an exception. 😭 so check which driver you're on first, i'm begging.

any parameters with a leading underscore are considered private driver-specific options and will be passed through without alteration.

any other parameters without a leading underscore will be silently stripped out and not passed through to the driver. gone. not even a text back. πŸ’€

after calling "send_sms" the driver will do whatever is required to send the message, including (potentially, but not always) waiting for a confirmation from the network that the SMS has been sent. πŸ‘‘

given that drivers may do the actual mechanics of sending a message by quite a large variety of different methods, the "send_sms" method may potentially block for some time. timeout functionality is expected to be added later. so like, pack a snack. πŸ“

the "send_sms" returns:

  • true if the message was sent, or the driver is fire-and-forget and unable to determine success
  • false if the message was not sent

🫢 SUPPORT

bugs should be reported via the CPAN bug tracker at

<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SMS-Send>

for other issues, contact the author. don't be shy. πŸ’œ


🌈 AUTHOR

Adam Kennedy <adamk@cpan.org>


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.


and that's the whole page, bestie!! this was perl v5.36.0, dated 2023-08-18, and it's the SMS::Send(3pm) manual β€” go send some messages, you got this πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from