This file is indexed.

/usr/share/perl5/Padre/Logger.pm is in padre 1.00+dfsg-3.

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
package Padre::Logger;

=pod

=head1 NAME

Padre::Logger - Compile-time logging library for Padre

=head1 SYNOPSIS

  # In the launcher script
  $ENV{PADRE_DEBUG} = 1;



  use Padre;

  # In each Padre::Foo class
  use Padre::Logger;

  sub method {
      TRACE('->method') if DEBUG;

      # Your code as normal
  }

=head1 DESCRIPTION

This is a logging utility class for Padre. It provides a basic set of
simple functionality that allows for logging/debugging/tracing statements to be
used in Padre that will compile out of the application when not in use.

=cut

use 5.008;
use strict;
use warnings;
use threads;
use threads::shared;
use Carp            ();
use Time::HiRes     ();
use Padre::Constant ();

our $VERSION = '1.00';

# Handle the PADRE_DEBUG environment variable
BEGIN {
	if ( $ENV{PADRE_DEBUG} ) {
		if ( $ENV{PADRE_DEBUG} eq '1' ) {

			# Debug everything
			$Padre::Logger::DEBUG = 1;
		} else {

			# Debug a single class
			eval "\$$ENV{PADRE_DEBUG}::DEBUG = 1;";
		}
	}
}

sub import {
	if ( $_[1] and $_[1] eq ':ALL' ) {
		$Padre::Logger::DEBUG = 1;
	}
	my $pkg = ( caller() )[0];
	eval <<"END_PERL";
package $pkg;

use constant DEBUG => !! (
	defined(\$${pkg}::DEBUG) ? \$${pkg}::DEBUG : \$Padre::Logger::DEBUG
);

BEGIN {
	*TRACE = *Padre::Logger::TRACE;
	TRACE('::DEBUG enabled') if DEBUG;
}

1;
END_PERL
	die("Failed to enable debugging for $pkg") if $@;
	return;
}

# Global trace function
sub TRACE {
	my $time    = Time::HiRes::time;
	my $caller  = ( caller(1) )[3] || 'main';
	my $logfile = Padre::Constant::LOG_FILE;
	my $thread =
		  ( $INC{'threads.pm'} and threads->self->tid )
		? ( '(Thread ' . threads->self->tid . ') ' )
		: '';

	# open my $fh, '>>', $logfile or return;
	foreach (@_) {

		# print $fh sprintf(
		print sprintf(
			"# %.5f %s%s %s\n",
			$time,
			$thread,
			$caller,
			string($_),
		);
	}
	if ( $ENV{PADRE_DEBUG_STACK} ) {
		print Carp::longmess(), "\n";
		print '-' x 50, "\n";
	}

	# close $fh;
	return;
}

sub string {
	require Devel::Dumpvar;
	my $object = shift;
	my $shared = ( $INC{'threads/shared.pm'} and threads::shared::is_shared($object) ) ? ' : shared' : '';
	my $string =
		ref($object)
		? Devel::Dumpvar->_refstring($object)
		: Devel::Dumpvar->_scalar($object);
	return $string . $shared;
}

1;

# Copyright 2008-2013 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.