I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-05-20 19:53:16.760194-07 by chengwei
Can I return error (exit) code to system after a command is run?
Hi,

First of all, I want to express my appreciation to this framework. I've been using this framework for a while and I really like this framework because just like the Overview says, "It assumes the responsibility of implementing details that are common to all command-line applications, making it possible for new applications adhering to well-defined conventions". Other than that, adding new commands to this framework is so easy, I just have to fill in some "holes" in the framework (e.g. usage text, option spec and validation, and run() subroutine) and I can focus on the real business logic of the command in the run() and forget about many tedious things. Moreover, with the help of Inline-C and Inline-CPP, I can even write the main business logic of commands in C/C++, call it from the run() subroutine, and link it with my legacy C/C++ production code. This way, I don't have to be a Perl writer to use this Peral CLI framework. I can use this framework for non-Perl languages. That's cool!

As of this writing, the only thing I don't know how to do (and I'm not sure whether it can be done) is how to return error (exit) code to system after a command run is finished. Right now, the run() subroutine in the samples seems to always return output messages for display. Is there any way that, in addition to the output messages, I can also return error (exit) code to the system? I need this capability for scenarios such as test automation - by checking the command exit code my test program can determine its flow accordingly.

Thank you very much!

Chengwei
Direct Responses: 12716 | Write a response