diff --git a/check_backuppc/check_backuppc-1.1.0/check_backuppc b/check_backuppc/check_backuppc-1.1.0/check_backuppc index d8ea383..c994c20 100755 --- a/check_backuppc/check_backuppc-1.1.0/check_backuppc +++ b/check_backuppc/check_backuppc-1.1.0/check_backuppc @@ -32,7 +32,28 @@ no utf8; # Nagios use lib "NAGIOS_LIB"; -use utils qw(%ERRORS $TIMEOUT); +sub load_module { + my @names = @_; + my $module; + for my $name (@names) { + my $file = $name; + # requires need either a bare word or a file name + $file =~ s{::}{/}gsxm; + $file .= '.pm'; + eval { + require $file; + $name->import(qw(%ERRORS)); + $module = $name; + }; + last if $module; + } + return $module; +} + +my $plugin_module; +BEGIN { + $plugin_module = load_module( 'Monitoring::Plugin', 'Nagios::Plugin' ); +} use POSIX qw(strftime difftime); use Getopt::Long; Getopt::Long::Configure('bundling');