https://github.com/preaction/pod-usage-return
Pod::Usage that returns the exit code instead of calling exit()
https://github.com/preaction/pod-usage-return
Last synced: 11 months ago
JSON representation
Pod::Usage that returns the exit code instead of calling exit()
- Host: GitHub
- URL: https://github.com/preaction/pod-usage-return
- Owner: preaction
- License: other
- Created: 2014-05-09T03:25:26.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2019-09-09T00:11:54.000Z (almost 7 years ago)
- Last Synced: 2025-05-28T10:07:39.235Z (about 1 year ago)
- Language: Perl
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README
- Changelog: CHANGES
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
NAME
Pod::Usage::Return - pod2usage that returns instead of exits
VERSION
version 0.004
SYNOPSIS
use Pod::Usage::Return qw( pod2usage );
exit pod2usage(0);
sub main {
return pod2usage("ERROR: An error occurred!") if $ERROR;
}
exit pod2usage( -exitval => 1, -message => 'ERROR: An error occurred' );
DESCRIPTION
This is a drop-in replacement for Pod::Usage "pod2usage" that returns
the exit value instead of calling exit.
RATIONALE
Testing that your command-line script works is a good thing. It's a lot
easier to test a module, so writing your command-line script as a module
("modulino") makes it easier to test.
Unfortunately, Pod::Usage automatically calls "exit", which again makes
it harder to test your script. There is a way to prevent Pod::Usage from
exiting, but it makes using Pod::Usage a lot less convenient.
This module provides a drop-in "pod2usage" replacement that returns the
exit code instead of exiting, so that you can easily test your script
while using Pod::Usage.
FUNCTIONS
pod2usage
See Pod::Usage for documentation. Returns the exit code instead of
calling exit().
AUTHOR
Doug Bell
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Doug Bell.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.