diff options
author | Peter Bray <illumino@users.sourceforge.net> | 2005-07-25 01:47:15 +0000 |
---|---|---|
committer | Peter Bray <illumino@users.sourceforge.net> | 2005-07-25 01:47:15 +0000 |
commit | cdc06cc3e2c4670d3cd46b0a03adcf7e6958eff1 (patch) | |
tree | 62b074eaca618762fb03f94708ec3def50037697 /Helper.pm | |
parent | 05853f47eb6e608de993cc59343c73b96b9b33e2 (diff) | |
download | monitoring-plugins-cdc06cc3e2c4670d3cd46b0a03adcf7e6958eff1.tar.gz |
[1185704] New Testing Infrastructure.
Complete rewrite of the original testing infrastructure and
all test cases (to use the new infrastructure)
See NPTest.pm and issue 1185704 for more details.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1207 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'Helper.pm')
-rw-r--r-- | Helper.pm | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/Helper.pm b/Helper.pm deleted file mode 100644 index 198a6480..00000000 --- a/Helper.pm +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | package Helper; | ||
2 | use strict; | ||
3 | |||
4 | use Exporter(); | ||
5 | use vars qw($VERSION @ISA @EXPORT); | ||
6 | $VERSION = 0.01; | ||
7 | @ISA=qw(Exporter); | ||
8 | @EXPORT=qw(&get_option); | ||
9 | |||
10 | sub get_option ($$) { | ||
11 | my $file = 'Cache'; | ||
12 | my $response; | ||
13 | my $var = shift; | ||
14 | |||
15 | require "$file.pm"; | ||
16 | if(defined($Cache::{$var})){ | ||
17 | $response=$Cache::{$var}; | ||
18 | return $$response; | ||
19 | } | ||
20 | |||
21 | my $request = shift; | ||
22 | my $filename; | ||
23 | my $path; | ||
24 | foreach $path (@INC) { | ||
25 | $filename="$path/$file.pm"; | ||
26 | last if (-e $filename); | ||
27 | } | ||
28 | print STDERR "Enter $request\n"; | ||
29 | $response=<STDIN>; | ||
30 | chop($response); | ||
31 | open(CACHE,"<$filename") or die "Cannot open cache for reading"; | ||
32 | undef $/; | ||
33 | my $cache = <CACHE>; | ||
34 | $/="\n"; | ||
35 | close CACHE; | ||
36 | $cache =~ s/^(\@EXPORT\s*=\s*qw\(\s*[^\)]*)\)\s*;/$1 $var\)\;/msg; | ||
37 | $cache =~ s/^1;[\n\s]*\Z/\$$var=\"$response\"\;\n1\;\n/msg; | ||
38 | open(CACHE,">$filename") or die "Cannot open cache for writing"; | ||
39 | print CACHE $cache; | ||
40 | close CACHE; | ||
41 | return $response; | ||
42 | } | ||
43 | |||
44 | 1; | ||