This file is indexed.

/usr/share/perl5/Devel/Confess/Builtin.pm is in libdevel-confess-perl 0.009004-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package Devel::Confess::Builtin;
use strict;
use warnings FATAL => 'all';
no warnings 'once';

our $VERSION = '0.009004';
$VERSION = eval $VERSION;

use Devel::Confess::_Util ();

{
  package #hide
    Devel::Confess::Builtin::_Guard;
  use overload bool => sub () { 0 };
  sub new { bless [@_[1 .. $#_]], $_[0] }
  sub DESTROY {
    return
      if Devel::Confess::_Util::_global_destruction;
    $_->() for @{$_[0]}
  }
}

our %CLASS = (
  'Exception::Class::Base' => {
    enable => sub { Exception::Class::Base->Trace(1) },
    store => '$Exception::Class::BASE_EXC_CLASS',
  },
  'Ouch' => {
    enable => sub { overload::OVERLOAD('Ouch', '""', 'trace') },
    store => '@Ouch::EXPORT_OK',
  },
  'Class::Throwable' => {
    enable => sub { $Class::Throwable::DEFAULT_VERBOSITY = 2 },
    store => '$Class::Throwable::DEFAULT_VERBOSITY',
  },
  'Exception::Base' => {
    enable => sub { Exception::Base->import(verbosity => 3) },
    store => sub {
      my $guard = shift;
      $Exception::Base::_qualify_to_ref
          = Devel::Confess::Builtin::_Guard->new(sub {
        $Exception::Base::VERSION = $guard;
      });
    },
  },
);

sub import {
  my ($class, @enable) = @_;
  @enable = keys %CLASS
    unless @enable;

  for my $class (@enable) {
    my $class_data = $CLASS{$class} or die "invalid class $class!";
    next if $class_data->{enabled};

    (my $module = "$class.pm") =~ s{::}{/}g;
    if ($INC{$module}) {
      $class_data->{enable}->();
      $Devel::Confess::NoTrace{$class}++;
    }
    else {
      my $store = $class_data->{store};
      my $guard = Devel::Confess::Builtin::_Guard->new(
        $class_data->{enable},
        sub { $Devel::Confess::NoTrace{$class}++ },
      );

      if (ref $store) {
        $store->($guard);
      }
      else {
        eval $store . ' = $guard; 1' or die $@;
      }
    }

    $class_data->{enabled}++;
  }
}

sub unimport {
  my ($class, @disable) = @_;
  @disable = keys %CLASS
    unless @disable;

  for my $class (@disable) {
    my $class_data = $CLASS{$class} or die "invalid class $class!";
    next unless $class_data->{enabled};

    (my $module = "$class.pm") =~ s{::}{/}g;
    if ($INC{$module}) {
      # can't really disable if it's already been loaded, so just do nothing
    }
    else {
      my $store = $class_data->{store};
      if (ref $store) {
        $class_data->{disable}->();
      }
      else {
        eval q{
          my ($guard) = }.$store.q{;
          @$guard = ();
          }.$store.q{ = ();
          1;
        } or die $@;
      }
      $class_data->{enabled}--;
      $Devel::Confess::NoTrace{$class}--;
    }
  }
}

1;
__END__

=head1 NAME

Devel::Confess::Builtin - Enable built in stack traces on exception objects

=head1 SYNOPSIS

  use Devel::Confess::Builtin;
  use Exception::Class 'MyException';

  MyException->throw; # includes stack trace

=head1 DESCRIPTION

Many existing exception module can provide stack traces, but this
is often not the default setting.  This module will force as many
modules as possible to include stack traces by default.  It can be
loaded before or after the exception modules, and it will still
function.

For supported modules, it will also prevent L<Devel::Confess>
from attaching its own stack traces.

=head1 SUPPORTED MODULES

=over 4

=item *

L<Exception::Class>

=item *

L<Ouch>

=item *

L<Class::Throwable>

=item *

L<Exception::Base>

=back

=head1 CAVEATS

This module relies partly on the internal implementation of the
modules it effects.  Future updates to the modules could break or
be broken by this module.

=cut