This file is indexed.

/usr/share/perl5/Text/German/Cache.pm is in libtext-german-perl 0.06-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
#                              -*- Mode: Perl -*- 
# Cache.pm -- 
# Author          : Ulrich Pfeifer
# Created On      : Mon May 13 11:14:06 1996
# Last Modified By: Ulrich Pfeifer
# Last Modified On: Sun Apr  3 11:43:04 2005
# Language        : CPerl
# Update Count    : 17
# Status          : Unknown, Use with caution!

package Text::German::Cache;

sub new {
  my $type = shift;
  my $self = {};
  my %para = @_;

  $self->{Function} = $para{Function} || \&Text::German::reduce;
  $self->{Hold}     = $para{Hold}     || 100;
  $self->{Gc}       = $para{Gc}       || 2 * $self->{Hold};
  $self->{Verbose}  = $para{Verbose}  || 0;
  $self->{Entries}  = 0;
  $self->{Contents} = {};
  $self->{Hit}      = {};
  $self->{Hits}     = 0;
  $self->{Misses}   = 0;
  bless $self, ref($type) || $type;
}

sub get {
  my $self = shift;
  my $key  = shift;

  if (defined $self->{Contents}->{$key}) {
    $self->{Hits}++;
    $self->{Hit}->{$key}++;
  } else {
    $self->{Misses}++;
    $self->{Entries}++;
    if ($self->{Entries} >= $self->{Gc}) {
      $self->gc;
    }
    $self->{Contents}->{$key} = &{$self->{Function}}($key);
  }
  $self->{Contents}->{$key};
}

sub gc {
  my $self = shift;
  my %rank;
  my $rank;
  
  if ($self->{Verbose}) {
    printf (STDERR "Cache: enter garbadge collect %d\n", $self->{Entries});
  }
  for (keys %{$self->{Contents}}) {
    push @{$rank{$self->{Hit}->{$_}}}, $_;
  }
  for $rank (sort {$a <=> $b} keys %rank) {
    for (@{$rank{$rank}}) {
      if ($self->{Verbose}) {
        printf (STDERR "Cache: deleting $_(%d)\n", $rank+1);
      }
       delete $self->{Contents}->{$_};
       delete $self->{Hit}->{$_};
       $self->{Entries}--;
     }
    # We delete a complete rank. this is more than we must do ..
    last if $self->{Entries} <= $self->{Hold};
  }
  if ($self->{Verbose}) {
    printf (STDERR "Cache: leave garbadge collect %d\n", $self->{Entries});
  }
}

sub DESTROY {
  my $self = shift;

  if ($self->{Verbose}) {
    printf (STDERR "\nCache Hits: %d\tMisses: %d\n", $self->{Hits}, $self->{Misses});
  }
}

1;