Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modulino can't be tested when using pod2usage #1

Open
preaction opened this issue Jun 19, 2013 · 4 comments
Open

Modulino can't be tested when using pod2usage #1

preaction opened this issue Jun 19, 2013 · 4 comments

Comments

@preaction
Copy link
Member

pod2usage calls "exit()", we need some test boilerplate to fix that problem

@preaction
Copy link
Member Author

Correction: You can load the modulino and do: system 'perl', $INC{'modulino.pm'}, qw( arguments );, and use Capture::Tiny to capture the output, but that's kind of strange. Of course, that only has to be done for the error conditions, or when testing the main() sub.

@run4flat
Copy link

Don't you think this can or should be filed as a bug, or maybe feature request, of pod2usage?

@preaction
Copy link
Member Author

pod2usage already has a "don't exit" mode, but you have to explicitly enable it. There's also a way to override CORE::GLOBAL::exit, which is what App::Cmd::Tester does.

But the non-CPAN (core module) slides need some way to do it. Overriding *CORE::GLOBAL::exit will work as long as it's done before the modulino (or specifically Pod::Usage) is loaded and the function is bound.

Adding a package var to Pod::Usage might also work. OR, instead of calling exit() specifically, it could die with a dualvar (exit code and error message). But I'm not sure how much backwards compatibility that will affect.

@preaction
Copy link
Member Author

Ha. I wrote Pod::Usage::Return for exactly this reason! I should update the modulino bit to mention it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants