in reply to how should a cli script return error codes?

I think you just want exit(100);. That makes your program exit with an error code 100.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart