aditya1977 has asked for the wisdom of the Perl Monks concerning the following question:

I have a custom nagios plugin which is written in Perl. For complicated political reasons I am required to hide the source code of this plugin. The only way I found to do this was by using perlc (http://marginalhacks.com/Hacks/perlc).

In the words of author: "Takes a single perl script, converts the block using a simple encoding with an optionally defined key. The script is decoded at runtime and fed to the perl library, to avoid it getting in the hands of the user."

The problem I am getting is that Nagios shows "No output returned from plugin" when I used the compiled version of the plugin. The raw perl source works just fine, as does running the compiled version on the command line.

After debugging for a while I narrowed the problem down to using exit in perl. I.e This works fine when compiled.

print "OK: Everything is working fine.\n";
This however does not work and results in ""No output returned from plugin"
print "OK: Everything is working fine.\n"; exit 1;
It doesn't matter how I exit (0 1 2 or 3) I still get the same problem. I've tried POSIX::_exit(0) instead but no difference?

Replies are listed 'Best First'.
Re: Nagios plugin gives “no output returned” using compiled perl
by Anonymous Monk on Aug 01, 2014 at 13:01 UTC

    Are you completely sure that exit 0; is different from no exit at all?

    As silly as it might be, what about Acme::Bleach to "hide" your source? PAR::Packer also has a few filters for obfuscation.

    Random guess, have you tried $|=1;?

      That was it!!

      $| = 1;

      OMG I cant believe it was so stupidly obvious!! Thanks's a bunch!! Ive posted this everywhere but Perl monks are the best :-)

Re: Nagios plugin gives “no output returned” using compiled perl
by marto (Cardinal) on Aug 01, 2014 at 12:53 UTC
Re: Nagios plugin gives “no output returned” using compiled perl
by McA (Priest) on Aug 01, 2014 at 13:06 UTC
Re: Nagios plugin gives “no output returned” using compiled perl
by MidLifeXis (Monsignor) on Aug 01, 2014 at 17:35 UTC