The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::DoOrDie - do-file replacement that dies on errors

SYNOPSIS

 use Acme::DoOrDie;

 do_or_die("config.pl");

DESCRIPTION

Error handling for the do(FILENAME) built-in function is inconvenient. The main problem is that you need to examine more than just the return value to distinguish a file-not-found condition from a successful invocation of a file that ends with these two statements:

 $! = ENOENT;
 undef;

(The autodie module can't help you since it doesn't support the do function.)

This module provides the replacement function do_or_die that reports any error by throwing an exception. The same function is also available under the alias do (not exported by default).

EXPORTS

By default:
do_or_die
On request:
do

AUTHOR

Bo Lindbergh <blgl@stacken.kth.se>

COPYRIGHT AND LICENSE

Copyright 2017 Bo Lindbergh

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.