Nagios:...tResult(3)

πŸ“¦ version 0.36, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so welcome to the Nagios::Plugin::ExitResult manual page, section 3, coming at you from the User Contributed Perl Documentation besties πŸ’…. This class is a helper class for returning both output and return codes when testing. That’s the whole NAME vibe: output + return codes, testing time, no cap ✨.

✨ SYNOPSIS ✨

Here’s the little code moment, literally copy-paste energy:

use Test::More;
use Nagios::Plugin::Functions;

# In a test file somewhere
Nagios::Plugin::Functions::_fake_exit(1);

# Later ...
$e = nagios_exit( CRITICAL, 'aiiii ...' );
print $e->message;
print $e->return_code;

# NP::ExitResult also stringifies to the message output
like(nagios_exit( WARNING, 'foobar'), qr/^foo/, 'matches!');

ok so quick translation: in a test file somewhere you’ve got Nagios::Plugin::Functions::_fake_exit(1), then later nagios_exit( CRITICAL, 'aiiii ...' ) hands you $e, and you can print $e->message and $e->return_code. Also: NP::ExitResult stringifies to the message output, so that like(nagios_exit( WARNING, 'foobar'), qr/^foo/, 'matches!') match is a slay 🌈.

πŸ¦‹ DESCRIPTION πŸ¦‹

Nagios::Plugin::ExitResult is a tiny helper class intended for use when testing other Nagios::Plugin modules. A Nagios::Plugin::ExitResult object is returned by nagios_exit() and friends when Nagios::Plugin::Functions::_fake_exit has been set, instead of doing a conventional print + exit. It’s giving test-helper main character energy, not full program energy 🌸.

πŸ‘‘ AUTHOR πŸ‘‘

Author credit goes to: Gavin Carr , <gavin@openfusion.com.au> 🫢.

Copyright (C) 2006 by Nagios Plugin Development Team.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


That’s the whole page, bestie πŸ’–. Signing off with perl v5.42.0, dated 2024-03-04, and the Nagios:...tResult(3) footer. Bye bye, go test something iconic πŸ‘‘βœ¨

πŸ“¦ where this page comes from