1Nagios::Plugin::ExitResUusletr(3C)ontributed Perl DocumeNnatgaitoiso:n:Plugin::ExitResult(3)
2
3
4
6 Nagios::Plugin::ExitResult - Helper class for returning both output and
7 return codes when testing.
8
10 use Test::More;
11 use Nagios::Plugin::Functions;
12
13 # In a test file somewhere
14 Nagios::Plugin::Functions::_fake_exit(1);
15
16 # Later ...
17 $e = nagios_exit( CRITICAL, 'aiiii ...' );
18 print $e->message;
19 print $e->return_code;
20
21 # NP::ExitResult also stringifies to the message output
22 like(nagios_exit( WARNING, 'foobar'), qr/^foo/, 'matches!');
23
25 Nagios::Plugin::ExitResult is a tiny helper class intended for use when
26 testing other Nagios::Plugin modules. A Nagios::Plugin::ExitResult
27 object is returned by nagios_exit() and friends when
28 Nagios::Plugin::Functions::_fake_exit has been set, instead of doing a
29 conventional print + exit.
30
32 Gavin Carr , <gavin@openfusion.com.au>
33
35 Copyright (C) 2006 by Nagios Plugin Development Team
36
37 This library is free software; you can redistribute it and/or modify it
38 under the same terms as Perl itself.
39
40
41
42perl v5.12.1 2010-04-15 Nagios::Plugin::ExitResult(3)