This file is indexed.

/usr/share/perl5/Catmandu/Fix/Bind/list.pm is in libcatmandu-perl 0.9206-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
package Catmandu::Fix::Bind::list;

use Moo;
use Data::Dumper;
use Catmandu::Util;

with 'Catmandu::Fix::Bind';

has path => (is => 'ro');

sub zero {
	my ($self) = @_;
	[];
}

sub unit {
	my ($self,$data) = @_;

	if (defined $self->path) {
		Catmandu::Util::data_at($self->path,$data);
	}
	elsif (Catmandu::Util::is_array_ref($data)) {
		$data;
	}
	else {
		[$data];
	}	
}

sub bind {
	my ($self,$mvar,$func,$name) = @_;

	if (Catmandu::Util::is_array_ref($mvar)) {
		concat ( [ map { $func->($_) } @$mvar ] );
	}
	else {
		return $self->zero;
	}
}

# Flatten an array: [ [A] , [A] , [A] ] -> [ A, A, A ]
sub concat {
	[ map { Catmandu::Util::is_array_ref($_) ? @$_ : $_ } @{$_[0]} ];
}

=head1 NAME

Catmandu::Fix::Bind::list - a binder that computes Fix-es for every element in a list

=head1 SYNOPSIS

 add_field(demo.$append.test,1)
 add_field(demo.$append.test,2)

 do list(path => demo)
	add_field(foo,bar)
 end

 # will produce
   demo:
   	 - test: 1
   	   foo: bar
   	 - test: 2
   	   foo: bar

=head1 DESCRIPTION

The list binder will iterate over all the elements in a list and fixes the values in context of that list.

=head1 CONFIGURATION

=head2 path 

The path to a list in the data.

=head1 AUTHOR

Patrick Hochstenbach - L<Patrick.Hochstenbach@UGent.be>

=head1 SEE ALSO

L<Catmandu::Fix::Bind>

=cut

1;