#!/usr/bin/perl -w #Copyright (c) 2001 Giulio Motta. All rights reserved. #This program is free software; you can redistribute it and/or #modify it under the same terms as Perl itself. package WWW::SMS; use Carp (); $VERSION = '0.01'; sub new { my $class = shift; my $self; if (@_ == 4) { my ($intpref, $prefix, $telnum, $smstext) = @_; $self = bless { 'intpref' => $intpref, 'prefix' => $prefix, 'telnum' => $telnum, 'smstext' => $smstext }, $class; } else { $self = bless{}, $class; } } sub send_sms { my ($class, $sms, $gateway) = @_; my $gate = "${class}::${gateway}"; eval "use $gate qw(" . '%PREFIXES _send)'; Carp::croak("not such a gateway available: $gateway ($@)\n") if ($@); if (%PREFIXES) { ((warn "Prefix $sms->{prefix} not supported by $gateway") && return 0) unless (exists $PREFIXES{$sms->{prefix}}); } return _send($sms); }