NAME

Pod::Usage::Return - pod2usage that returns instead of exits

VERSION

version 0.003

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 <preaction@cpan.org>

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.