This file is indexed.

/usr/share/perl5/Petal/Utils/Limitr.pm is in libpetal-utils-perl 0.06-2.

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
package Petal::Utils::Limitr;

use strict;
use warnings::register;

use Carp;

use base qw( Petal::Utils::Base );

use constant name    => 'limitr';
use constant aliases => qw();

our $VERSION  = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2];

sub process {
    my $class = shift;
    my $hash  = shift;
    my $args  = shift || confess( "'limitr' expects 2 variables (got nothing)!" );

    my @args = $class->split_args( $args );
    my $key = $args[0] || confess( "1st arg to 'limit' should be an array (got nothing)!" );
    my $count = $args[1] || confess( "2nd arg to 'limit' should be a variable (got nothing)!" );

    my $arrayref = $hash->fetch($key);
    # Shuffle full array
    fisher_yates_shuffle($arrayref);
    $count--;
    # trim $count to max size of array
    $count = $#$arrayref if $#$arrayref < $count;
    return [] if $count < 0;
    return [@{$arrayref}[0 .. $count]];

}


# Generate a random permutation of @array in place
# Usage: fisher_yates_shuffle( \@array ) :
sub fisher_yates_shuffle {
  my $array = shift;
  return unless $#$array >= 0;
  my $i;
  for ($i = @$array; --$i; ) {
    my $j = int rand ($i+1);
    next if $i == $j;
    @$array[$i,$j] = @$array[$j,$i];
  }
}


1;

__END__

Description: Limit elements returned from a randomized array

Basic Usage:
  limitr:<list> <count>
    list - a list
    count - an integer value, if greater than the total items in the list,
      return complete list

Example:
    <div class="content" tal:repeat="fact limitr:facts 2">
      <p tal:content="fact/fld_fact">Fact</p>
    </div>