Pod::Usage::Return - pod2usage that returns instead of exits
version 0.004
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' );
This is a drop-in replacement for Pod::Usage pod2usage
that returns the
exit value instead of calling exit.
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.
See Pod::Usage for documentation. Returns the exit code instead of calling exit().
Doug Bell preaction@cpan.org
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.