summaryrefslogtreecommitdiff
path: root/dist/Carp
Commit message (Collapse)AuthorAgeFilesLines
* Update Carp.pmElvin Aslanov2022-09-052-4/+4
| | | | Add `my` to synopsis.
* Revert "regex: Add POSIXA1R node"Karl Williamson2022-07-012-4/+2
| | | | | | | This reverts commit d62feba66bf43f35d092bb026694f927e9f94d38. As explained in its commit message. It adds some comments to point out that the commit exists, for the curious.
* regex: Add POSIXA1R nodeKarl Williamson2022-07-012-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Several of the POSIXA classes are a single range on ASCII platforms, and [:digit:] is a single range on both ASCII and EBCDIC. This regnode was designed to replace the POSIXA regnode for such classes to get a bit of performance by not needing to do an array lookup. Instead it encodes some bits in the flags field that with shifting and masking get the right values for the single range's bounds for any such node. However, performance tests conducted by Sergey Aleynikov showed this was actually slower than what it intended to replace. Rather than completely drop this work, I'm adding it to blead, and immediately reverting it, so that should parts of it ever become useful, it would be available. A few tests fail; those are skipped for the purposes of this commit so that it doesn't interfere with bisecting. The code also isn't completely commented. One could add a regnode for each posix class it was decided should have the expected performance boost. But regnodes are a finite resource, and the boost is probably not large enough to justify doing so.
* Carp: Use some proper hyperlinks in podKarl Williamson2022-05-271-2/+2
|
* Fix a typo in a comment in Carp.pmNicholas Clark2022-05-272-3/+3
| | | | Bump $CARP::VERSION and $Carp::Heavy::VERSION
* Fix POD for $Carp::RefArgFormatterDaniel Böhmer2021-01-182-6/+6
| | | | | | | | | | - Data::Dumper::Dump() MUST be called as class method - indent example for code markup Also added myself to AUTHORS as requested: Ran './Porting/checkAUTHORS.pl --update --from=v5.30.0' and fixed the entry by hand because of broken Unicode chars.
* bump $Carp::VERSIONTony Cook2020-11-242-2/+2
|
* fix context of caller call in CarpGraham Knop2020-11-231-1/+1
| | | | | | | | Carp's CARP_NOT variable is meant to have package names. caller in list context returns the calling file and line in addition to the package name. Enforce scalar context on the call to caller to fix this.
* add gitignore exclusions for files in gitGraham Knop2020-11-231-0/+1
| | | | | | | | There are a number of files excluded using gitignore rules that are included in the repository. This can lead to confusion if something other than git tries to read the ignore files. Add rules to the gitignore files so that these files won't be ignored.
* Make dist/Carp strict compliant.Todd Rinaldo2020-09-305-9/+26
|
* delete unreliable test of Carp crash avoidanceZefram2018-03-303-27/+2
| | | | | | | | | | | | | rt52610_crash.t was introduced by commit 4764858cb80e76fdba33cc1b3be8fcdef26df754, and is predicated on the mythical effectiveness of that commit's code change in avoiding stack-not-refcounted crashes, an effectiveness also expressed in that commit's very inaccurate commit message. In fact the code change will avoid *some* crashes, but cannot guarantee to avoid crashing in any particular situation of the kind that it targets. It is therefore not possible to have a test for it avoiding a stack-not-refcounted crash, with any expectation that the test would reliably pass or even reliably avoid crashing. rt52610_crash.t must therefore be deleted.
* Carp: Use ${^LAST_FH} if availableFather Chrysostomos2018-03-111-1/+20
| | | | | | | | | | | Using ${^LAST_FH}, available in 5.18, in faster than using eval/die to get the last file handle. Also, the eval/die method is not going to produce anything if $. is 0 so skip that entire block if $. is false (by removing the defined check). (Not significant enough for perldelta. carp("zonk") gets faster by only 5% or so.)
* Don't run stack_after_err.t on VMS.Craig A. Berry2018-03-081-2/+6
| | | | It uses IPC::Open3, which uses fork(), which doesn't exist.
* rework Carp/t/stack_after_err.t to not use perl -eYves Orton2018-02-281-63/+55
|
* Carp: Speed up longmess some moreFather Chrysostomos2018-02-271-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 915a6810d added a UNIVERSAL::isa check to format_arg (used by longmess, which generates stack traces) to see whether an argument is blessed before trying CARP_TRACE, to speed things up when the argu- ment is not blessed. Because this would cause infinite recursion when the UNIVERSAL::isa module is loaded, a check was put in place to avoid this problem. But the check was a run-time check, and so the speed-up was minimal. If we move the check to compile time (and save the original &UNIVERSAL::isa in case the module gets loaded later), then the speed- up is signifant. That is what this patch does. Before this patch, the following one-liner runs on my machine in 6 seconds on average: $ ./perl -MCarp -Ilib -e 'sub f { my $c = shift; if ($c == 100) { Carp::longmess() } else { f($c+1,{}) } } f(0,{}) for 1..500' If I disable the isa check (just to see how much it was speeding things up), it averages 6.5 seconds, not much of a difference. If I move the $UNIVERSAL::isa::VERSION safety check to compile time instead of run time, I can reduce the time to 4.9 seconds.
* Carp: Avoid run-time mods; StrVal workaroundsFather Chrysostomos2018-02-273-29/+147
| | | | | | | | | | | | | | | | | | | | | | | Carp needs to avoid loading modules while reporting errors, because it may be invoked via $SIG{__DIE__} after a syntax error, when BEGIN blocks are forbidden. Before this commit (as of v5.27.8-360-gc99363a) it was doing just that for reference arguments within stack traces. That means we either need to load overload.pm at start-up so that overload::StrVal is already available, or avoid overload::StrVal altogether. It turns out that various versions of overload::StrVal have their own problems that prevent Carp from using them (out- lined in the comments added to Carp.pm and also described at <https://rt.perl.org/Ticket/Display.html?id=132902#txn-1535564>). So we now follow two approaches: If overloading.pm is available, use that; otherwise, use a hideous workaround inspired by ancient imple- entations of overload::StrVal and Scalar::Util::blessed, while avoid- ing the bugs in those old versions.
* [perl #132910] Carp: Avoid ->canFather Chrysostomos2018-02-253-21/+68
| | | | | | | | If a module has its own ‘can’ (or even UNIVERSAL::can) implementation, it may impede Carp’s use of ->can to detect overloading. Instead, use UNIVERSAL::can directly, or, in the presence of an override, use overload::mycan. Don’t use overload::Overloaded, since old versions of overload call ->can.
* Carp: add test for overloads without overload.pmYves Orton2018-02-251-0/+15
|
* Carp: overloads can be enabled with via ::() as well as ::((Yves Orton2018-02-251-1/+1
|
* Carp: add comment explaining the fix for perl #131046Yves Orton2018-02-243-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | In 4764858cb80e76fdba33cc1b3be8fcdef26df754 I added code that eval's the argument extraction from DB::args() (code written by both Pali and myself independently). Unfortunately the commit message for that commit was somewhat misleading, making it sound like the patch was a complete fix for the underlying problem of stack-not-refcounted bugs, when in fact it is actually a workaround, and a not-universally popular one either due to its incompleteness. For more details of why it is not popular see Zeframs commentary in https://rt.perl.org/Public/Bug/Display.html?id=131046 Despite the concerns expressed by Zefram when considered from the POV of a large enterprise using Carp to trap exceptions from application code, having Carp throw its own exceptions about stack-not-refcounted bugs and thus hiding the applications error data is a significant issue. So in 4764858cb80e76fdba33cc1b3be8fcdef26df754 we use eval to handle those cases where Perl /can/ detect a stack-not-refcounted error, and thus preserve as much of the applications error data as possible. This commit adds a comment to Carp which spells all of this out.
* Fix perl #132902 - Carp: avoid infinite loops when checking for overloadsYves Orton2018-02-243-14/+43
| | | | | | | | | | | | We use $obj->can("((") to see if a package has enabled overloads, however in some cases can() is overridden with a custom implementation, which may be unaware of these methods and then call Carp itself. This then results in an infinite loop. An example is Class::Std v0.013. While technically this is a bug in whatever overrides UNIVERSAL::can(), Carp is so prolific in its use that we might as well treat it as a Carp bug also and avoid the problem outright. See also: https://github.com/chorny/Class-Std/pull/2
* Revert "Revert "Carp: Avoid string eval""Yves Orton2018-02-241-4/+4
| | | | | | | | This reverts commit f61fbe7bb36915d6a598df82ede2511d261e41d3. After further research it appears that this does NOT break .pmc's The docs on .pmc's leave much to be desired.
* Revert "Carp: Avoid string eval"Yves Orton2018-02-241-4/+4
| | | | | | | | This reverts commit 7bb6e12450c58b7094ccdfa7025fa495d3996bcf. This patch breaks the behavior of .pmc's. :-( Until we decide if breaking this rarely used feature is ok I am reverting.
* Carp: Avoid string evalFather Chrysostomos2018-02-231-4/+4
| | | | | | | | | | | | | | | Carp’s particular use of string eval is unnecessary in this case, and slower than the alternative. Carp’s reason for using string eval is to avoid the effect of bareword require vivifying a package. But that only applies to bareword require, and not other forms of require: $ perl -le 'print $::{"overload::"}||"nothing"; require overload' *main::overload:: $ perl -le 'print $::{"overload::"}||"nothing"; require "overload.pm"' nothing Since string eval has to set up a parser and a new scope, it is much slower that require, and quite unnecessary here.
* better comments about Carp overload logicZefram2018-02-241-10/+9
| | | | | | The comments originally added by commit c99363aa273278adcad39f32026629b700f9bbc3 for [perl #132828] were unclear and a bit over-excited.
* remove spurious _ part of Carp version numberZefram2018-02-242-2/+2
| | | | | | | | Commit 4764858cb80e76fdba33cc1b3be8fcdef26df754 unwisely changed Carp's version number to an underscored one. Commit c99363aa273278adcad39f32026629b700f9bbc3 incremented the underscored part and copied it to Carp::Heavy. With blead being upstream for Carp, there is no reason for it to have an underscored version number.
* fix Perl #132828 - dont use overload to bypass overloadsYves Orton2018-02-233-11/+25
| | | | | | | | | | | | | the internals don't need overload.pm to be loaded to enable overloads which means that Carp needs to defend against overload without checking if overload.pm is loaded either. One odd thing about this change is that if I remove the "eval" that wraps the "require" then we fail tests in dist/Carp/t/vivify_stash.t which defies expectation as the require is never actually executed from that code. This patch doesn't have tests yet as it can segfault perl.
* Fix RT #52610: Carp: Do not crash when reading @DB::argsPali2018-02-233-8/+43
| | | | | | | | | | | | | | | | | | | Trying to read values from array @DB::args can lead to perl fatal error "Bizarre copy of ARRAY in scalar assignment". But missing, incomplete or possible incorrect value in @DB::args is not a fatal error for Carp. Carp is primary used for reporting warnings and errors from other modules, so it should not crash perl when trying to print error message. This patch safely iterates all elements of @DB::args array via eval { } block and replace already freed scalars for Carp usage by string "** argument not available anymore **". This prevent crashing perl and allows to use Carp module. It it not a proper fix but rather workaround for Carp module. At least it allows to safely use Carp. Patch amended by Yves Orton
* avoid vivifying UNIVERSAL::isa:: in CarpZefram2018-02-153-6/+22
| | | | | | | | The test added to Carp by commit 915a6810d3e3198d759f025f85d1fd6f3171dd27 for UNIVERSAL::isa being loaded had the side effect of vivifying the UNIVERSAL::isa stash. Take more care about checking for UNIVERSAL::isa to avoid vivifying it, as for the other checks for things in optional modules. Fixes [perl #132788].
* Bump Carp to version 1.45Nicolas R2017-11-213-3/+3
| | | | | | Previous Carp update from 915a6810d3 was merged after 5.27.6 release... so we need to bump the release version.
* Carp: optimize format_arg when arguments contain many referencesJ. Nick Koston2017-11-212-1/+10
| | | | | | | | | | | | | | | | | | RT #132274 This is a very minimal patch after RT discussion. When using the CPAN version of UNIVERSAL::isa we cannot use UNIVERSAL::isa on Carp without taking the risk of going into one infinite loop. As UNIVERSAL::isa on CPAN is the only one to advertise a VERSION, we can use this value to disable the UNIVERSAL check. Note version bump is not required as it already occurred since v5.27.5 release. Signed-off-by: Nicolas R <atoomic@cpan.org>
* Revert "Speed up Carp.pm when backtrace arguments are references"Zefram2017-11-041-10/+10
| | | | | | This reverts commit 7a831b721c469aeccfe1110a2d177dd115d5998d. It was buggy and mostly pointless, and following criticism on p5p it should never have been committed.
* Speed up Carp.pm when backtrace arguments are referencesNicolas R2017-11-031-10/+10
| | | | | | | Avoid downgrading the string when not required. Author: J. Nick Koston <nick@cpanel.net> References: CPANEL-15140
* Increase $Carp::Heavy::VERSION to 1.44Father Chrysostomos2017-11-011-1/+1
|
* Increase $Carp::VERSION to 1.44Father Chrysostomos2017-11-011-1/+1
|
* Carp: Don’t choke on ISA constantFather Chrysostomos2017-11-012-2/+14
| | | | | | | | | | | | This broke some time between 1.29 (perl 5.18) and 1.3301 (perl 5.20): $ perl5.20.1 -e 'package Foo { use constant ISA => 42; Bar::f() } package Bar { use Carp; sub f { carp "tun syn" } }' Not a GLOB reference at /usr/local/lib/perl5/5.20.1/Carp.pm line 560. and still persisted in bleadperl (Carp 1.43) until this commit. The code that goes poking through the symbol table needs to take into account that not all stash elements are globs.
* fix problems from Carp's partial EBCDIC supportZefram2017-07-205-69/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 975fe8546427b5f6259103912b13925be148becd introduced partial EBCDIC support to Carp, but simultaneously introduced some bugs into the module and the tests. Multiple issues are addressed in this commit: * The main check for whether a character needs a non-literal representation when dumping a string or regexp argument, which used to be a regexp character range [ -~], was expanded to an explicit character set not using range syntax, but in the expansion the "&" was omitted. This caused unwanted \x representation of any "&" in an argument in a stack trace. Add the "&" back in and fix the sorting of the character set. * The substitute version of this check for Perls on which Carp can't safely apply a regexp to an upgraded string, but new enough to have utf8::native_to_unicode(), was applying that function to some fixed codepoint values that were already Unicode codepoints. Remove those calls, and compare the fixed codepoints directly to codepoints correctly converted through that function. * That version of the check, by referring to utf8::native_to_unicode() directly in source that is always compiled, caused the utf8:: stash to be vivified on Perl 5.6, causing havoc (and failed tests). Hide that version of the check behind a (compile-time) string eval. * Another version of the printability check, for EBCDIC on Perl 5.6, treated as printable any codepoint above 0xff. Change that to correctly treat all such codepoints as not safely printable. * Some tests in t/arg_regexp.t which were originally about non-ASCII characters specified in a regexp by using \x regexp syntax got changed to use the non-ASCII characters literally at the regexp syntax level (by interpolating them from a constructed string). Restore these to using \x syntax, with the appropriate variability of the hex digits. * Add a couple of "fixme" comments about parts of the EBCDIC support that are incomplete. * Some tests involving non-ASCII characters were later made to skip on any Perl prior to 5.17.1. In practice they work fine on earlier Perls, and they're fairly important. Suspect that the problem that led to the skipping being added was dependent on the tests having been broken as described above, so remove the skipping logic. * Incidentally, correct a comment about the purpose of t/arg_string.t and add a similar one to t/arg_regexp.t. * Incidentally, add Changes entries for versions 1.41 and 1.42, which were omitted when those changes were made.
* Carp/t/arg_string.t: fixup to previous fixupDavid Mitchell2016-10-271-2/+4
| | | | | I added alternates to a regex for matching a f/p number, but forgot to put parentheses around them. So it was being ridiculously over-liberal
* Carp/t/arg_string.t: be liberal in f/p formatsDavid Mitchell2016-10-271-1/+7
| | | | | | | | | | [perl #129954] dist/Carp/t/arg_string.t: Test fails This test script checks that args are displayed sensibly in longmess() output, but floating-point numbers can be displayed in various formats depending on platform, so make the regex more forgiving. Also add a comment to the top of the script explaining its purpose.
* vax-netbsd: do not tempt fp overflow, which will SIGFPEJarkko Hietaniemi2016-10-211-1/+1
| | | | The 3e100 seems to have no special meaning, except being in floating point.
* Carp: say what cluck() doesDavid Mitchell2016-08-112-3/+3
| | | | Nowhere did it actually describe what cluck does.
* [cpan#100183] Add missing "<FH> chunk #" phrase to Carp messagesAaron Crane2016-05-163-4/+15
| | | | | | | | | Commit 89988fbd2f7d8a44526a3cd9ab671b3102898bc9 added the relevant phrase for line-oriented filehandles; this extends that to also cover chunk-oriented ones. The patch was supplied by Chris R Donnelly <chris.donnelly@vauto.com> on the rt.cpan.org ticket; I have extended it to include a test.
* Carp: Fix .t failure to compile in v5.6Karl Williamson2016-03-172-2/+3
| | | | | This doesn't guarantee the tests pass in that release; just that it will actually get to testing.
* Add contributing info to Carp.Shlomi Fish2016-03-163-2/+11
| | | | | | | It lacked a link to the VCS repository so I had to ask rjbs about it on the #p5p IRC channel. And one should always fix a problem twice: * http://www.joelonsoftware.com/articles/customerservice.html .
* Document the previous commit in Carp's Changes.Shlomi Fish2016-03-071-0/+4
|
* Fix RTCPAN#107225 : longmess returns 1 on ref.Shlomi Fish2016-03-073-4/+24
| | | | | | | See: https://rt.cpan.org/Public/Bug/Display.html?id=107225 . Also discovered as a bug in perl -d by me (= Shlomi Fish) and reported after the original report. longmess() returns "1" when called in scalar context if passed a reference.
* Carp: stable CPAN releaseRicardo Signes2015-11-063-2/+5
|
* Carp: CPAN release 1.37_02Ricardo Signes2015-10-303-2/+5
|
* Carp: remove prereq on parent.pmRicardo Signes2015-10-291-1/+0
|
* Carp: prepare for a new CPAN releaseRicardo Signes2015-10-255-3/+139
|