/usr/share/perl5/HTTP/OAI/Debug.pm is in libhttp-oai-perl 3.27-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 | package HTTP::OAI::Debug;
=pod
=head1 NAME
B<HTTP::OAI::Debug> - debug the HTTP::OAI libraries
=head1 DESCRIPTION
This package is a copy of L<LWP::Debug> and exposes the same API. In addition to "trace", "debug" and "conns" this exposes a "sax" level for debugging SAX events.
=cut
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(level trace debug conns);
use Carp ();
my @levels = qw(trace debug conns sax);
%current_level = ();
sub import
{
my $pack = shift;
my $callpkg = caller(0);
my @symbols = ();
my @levels = ();
for (@_) {
if (/^[-+]/) {
push(@levels, $_);
}
else {
push(@symbols, $_);
}
}
Exporter::export($pack, $callpkg, @symbols);
level(@levels);
}
sub level
{
for (@_) {
if ($_ eq '+') { # all on
# switch on all levels
%current_level = map { $_ => 1 } @levels;
}
elsif ($_ eq '-') { # all off
%current_level = ();
}
elsif (/^([-+])(\w+)$/) {
$current_level{$2} = $1 eq '+';
}
else {
Carp::croak("Illegal level format $_");
}
}
}
sub trace { _log(@_) if $current_level{'trace'}; }
sub debug { _log(@_) if $current_level{'debug'}; }
sub conns { _log(@_) if $current_level{'conns'}; }
sub sax { _log(@_) if $current_level{'sax'}; }
sub _log
{
my $msg = shift;
$msg =~ s/\n$//;
$msg =~ s/\n/\\n/g;
my($package,$filename,$line,$sub) = caller(2);
print STDERR "$sub: $msg\n";
}
1;
|