MT 2116, Follow-up : Fix subfield separator
[koha.git] / C4 / SMS.pm
index 959e407..457a662 100644 (file)
--- a/C4/SMS.pm
+++ b/C4/SMS.pm
@@ -34,7 +34,6 @@ use strict;
 use warnings;
 
 use C4::Context;
-use SMS::Send;
 
 use vars qw( $VERSION );
 
@@ -52,10 +51,6 @@ BEGIN {
 
 =head2 send_sms
 
-=over4
-
-=back
-
 =cut
 
 sub send_sms {
@@ -67,6 +62,12 @@ sub send_sms {
         return unless defined $params->{ $required_parameter };
     }
 
+    eval { require SMS::Send; };
+    if ( $@ ) {
+        # we apparently don't have SMS::Send. Return a failure.
+        return;
+    }
+
     # This allows the user to override the driver. See SMS::Send::Test
     my $driver = exists $params->{'driver'} ? $params->{'driver'} : $self->driver();
     return unless $driver;