Acme-DoOrDie

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "do-file replacement that dies on errors",
   "author" : [
      "Bo Lindbergh <blgl@stacken.kth.se>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150005",
   "license" : [
      "unknown"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'do-file replacement that dies on errors'
author:
  - 'Bo Lindbergh <blgl@stacken.kth.se>'
build_requires:
  ExtUtils::MakeMaker: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150005'
license: unknown
meta-spec:

README  view on Meta::CPAN

A do-file replacement that dies on errors.

lib/Acme/DoOrDie.pm  view on Meta::CPAN

}

use Exporter
    qw(import);

1;

__END__
=head1 NAME

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

=head1 SYNOPSIS

 use Acme::DoOrDie;

 do_or_die("config.pl");

=head1 DESCRIPTION

Error handling for the C<do(FILENAME)> built-in function is

lib/Acme/DoOrDie.pm  view on Meta::CPAN

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 L<autodie> module can't help you since it doesn't support the
C<do> function.)

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

=head1 EXPORTS

=over

=item By default:

=over

t/00all.t  view on Meta::CPAN


eval {
    do_or_die("t/nonexistent.pl");
};
ok($@ =~ /^Can\'t locate t\/nonexistent\.pl/,
   "nonexistent file");

eval {
    do_or_die("t/syntax.pl");
};
ok($@ =~ /^syntax error/,
   "syntax error");

eval {
    do_or_die("t/runtime.pl");
};
ok($@ =~ /^explicit die/,
   "runtime error");



( run in 0.435 second using v1.01-cache-2.11-cpan-74e6d1fb12f )