Debian Codegraph @

debian/patches/check_printer/use_nagios_plugin

raw
1 Index: pkg-nagios-plugins-contrib/check_printer/check_printer
2 ===================================================================
3 --- pkg-nagios-plugins-contrib.orig/check_printer/check_printer
4 +++ pkg-nagios-plugins-contrib/check_printer/check_printer
5 @@ -33,11 +33,27 @@
6 use strict;
7 use warnings;
8
9 -my $OS = `uname`;
10 -if ($OS =~ m/^\wBSD/){
11 - use lib "/usr/local/libexec/nagios";
12 -} elsif ($OS =~ m/Linux/){
13 - use lib "/usr/local/nagios/libexec";
14 +sub load_module {
15 + my @names = @_;
16 + my $module;
17 + for my $name (@names) {
18 + my $file = $name;
19 + # requires need either a bare word or a file name
20 + $file =~ s{::}{/}gsxm;
21 + $file .= '.pm';
22 + eval {
23 + require $file;
24 + $name->import(qw(%ERRORS));
25 + $module = $name;
26 + };
27 + last if $module;
28 + }
29 + return $module;
30 +}
31 +
32 +my $plugin_module;
33 +BEGIN {
34 + $plugin_module = load_module( 'Monitoring::Plugin', 'Nagios::Plugin' );
35 }
36
37 use Getopt::Long;