package NaServerExt; # this is a wrapper around the *dummy version* of NaServer !! use strict; use warnings; use feature qw( say ); use Carp; use NaServer; sub run { my ($self, @argv) = @_; my $threshold = $argv[0] || croak 'no arguments'; if ($threshold =~ /\d+/) { my $session = NaServer->new(); my $val = $session->get_val(); if ($val > $threshold ) { _say_it ("Value to high: " . $val); exit 2; } else { _say_it ("Value OK ($val)"); exit 0; } } else { say 'invalid argument'; exit 3; } } sub _say_it { my $msg = shift; say $msg; return; } 1; __END__ =pod =head1 USAGE This module substitutes a script using NaServer.pm (the dummy-version only!). This way it is easier to test. It could be used by a script like this: #!/usr/bin/perl -w use warnings; use strict; use NaServerExt; NaServerExt->run(@ARGV); __END__ Do not forget: This is just for demonstrating something about testing and has nearly to nothing to do with NetApps NaServer modules!! =cut