FAQ
Test::More/Test::Builder work VERY hard to ensure nothing inside them
alters $! or $@. This is for thing like this:

     ok(do_something_scary());
is($!, 0, "expected $! val");
is($@, undef, '$@ not changed');

Without Test::More/Builder being careful to support this, the second 2
assertions could fail because something inside ok() modifies $! or $@.

*I cannot change Test::Builder/More* they must continue to protect $! and
$@, otherwise things break (I have a few downstream samples to show that it
does).

However. It is easy enough to have Test::Builder/More protect $! and $@
without requiring Test2 to do so.

Since Test2 is new, and nothing depends on any of its behaviors yet, I am
considering having Test2 not care about modifying $! and $@. So far I have
been taking care to preserve $! and $@, but it does add significant
complexity (and minor, but noticeable slowdown) to Test2.

*Reasons for dropping this promise from Test2:*

    - Simplifies code
    - $! and $@ are altered by many many things, adding { local ... } around
    all of them is a pain
    - Sometimes internals you don't expect to set $! will
    - Perl itself documents that you cannot depend on $! and $@ being
    unchanged past the immediate line after you set it.
    - Test::Builder will continue to protect $! and $@, so nothing will break
    - Test2 is new, nothing depends on it preserving these

*Reasons not to drop it:*

    - It is helpful to people who might not realize $! and $@ are often
    altered unexpectedly.

I am asking for input in case I missed any reasons/arguments for either
side. In either case backwards compatibility will be preserved.

-Chad

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 28 | next ›
Discussion Overview
groupcpan-workers @
categoriesperl
postedJan 12, '16 at 12:53a
activeJan 18, '16 at 10:52p
posts28
users8
websitecpan.org

People

Translate

site design / logo © 2021 Grokbase