develooper Front page | perl.perl5.porters | Postings from October 2017

How is Carp's @CARP_NOT supposed to work?

From:
=?UTF-8?Q?Daniel_B=C3=B6hmer?=
Date:
October 3, 2017 23:12
Subject:
How is Carp's @CARP_NOT supposed to work?
Message ID:
1c00104e65893b734e21c6af8a5e6485@daniel-boehmer.de
Hi Perl5 developers,

I've tried to reduce the use of $Carp::CarpLevel in some CPAN module and
found that @CARP_NOT works differently than I understood it. It calls
other code and currently uses `local $Carp::CarpLevel += 2` to reference
the user code in a croak() message.

The test file for @CARP_NOT's logic claims it is transitive. So I 
expected
that pushing several package names to @CARP_NOT in a module low in the
stacktrace effectively excludes these packages from error messages
creates above in the stacktrace.

I edited the test file based on the current `bleed` branch to verify my
understanding of the situation. See the diff for an example for the
description above.

https://github.com/dboehmer/perl5/commit/1961db115cd4ccdffce6b2c005ea1654e67529d8

Please have a look at the test file and tell me

- whether @CARP_NOT has ever been supposed to work like this

- whether @CARP_NOT could be extended to work like this and if you
support such a change

Kind regards
Daniel Böhmer alias DBOEHMER



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About