Carp-wo-B.patch 1020 B

1234567891011121314151617181920212223242526
  1. Recommended for 5.14
  2. Remove huge B dependency from Carp, introduced with 5.14 to detect
  3. incomplete caller override.
  4. This reduces the memory and run-time footprint in case of errors,
  5. and enables the compiler not to include B.
  6. diff -u Carp.pm.orig Carp.pm
  7. --- Carp.pm.orig 2011-12-31 18:13:12.000000000 -0600
  8. +++ Carp.pm 2011-12-31 18:13:47.000000000 -0600
  9. @@ -107,7 +107,12 @@
  10. local $@;
  11. my $where = eval {
  12. my $func = $cgc or return '';
  13. - my $gv = B::svref_2object($func)->GV;
  14. + my $gv =
  15. + *{
  16. + ( $::{"B::"} || return '') # B stash
  17. + ->{svref_2object} || return '' # entry in stash
  18. + }{CODE} # coderef in entry
  19. + ->($func)->GV;
  20. my $package = $gv->STASH->NAME;
  21. my $subname = $gv->NAME;
  22. return unless defined $package && defined $subname;