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