This file is indexed.

/usr/share/perl5/Set/Tiny.pm is in libset-tiny-perl 0.01-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
 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
package Set::Tiny;

use 5.004;
use strict;

$Set::Tiny::VERSION = '0.01';

sub new {
    my $class = shift;
    my %self;
    @self{@_} = ();
    return bless \%self, $class;
}

sub as_string { "(" . join(" ", sort keys %{$_[0]}) . ")" }

sub size { scalar keys %{$_[0]} }

sub element { exists $_[0]->{$_[1]} ? $_[1] : () }

sub elements { keys %{$_[0]} }

sub contains {
    my $self = shift;
    exists $self->{$_} or return for @_;
    return 1;
}

sub clone {
    my $class = ref $_[0];
    return $class->new( keys %{$_[0]} );
}

sub clear {
    %{$_[0]} = ();
    return $_[0];
}

sub insert {
    my $self = shift;
    @{$self}{@_} = ();
    return $self;
}

sub remove {
    my $self = shift;
    delete @{$self}{@_};
    return $self;
}

sub invert {
    my $self = shift;
    exists $self->{$_} ? delete $self->{$_} : ($self->{$_} = undef) for @_;
    return $self;
}

sub is_null { ! %{$_[0]} }

sub is_subset { $_[1]->contains( keys %{$_[0]} ) }

sub is_proper_subset { $_[0]->size < $_[1]->size && $_[0]->is_subset($_[1]) }

sub is_superset { $_[1]->is_subset($_[0]) }

sub is_proper_superset { $_[0]->size > $_[1]->size && $_[1]->is_subset($_[0]) }

sub is_equal { $_[1]->is_subset($_[0]) && $_[0]->is_subset($_[1]) }

sub is_disjoint { ! $_[0]->intersection($_[1])->size }

sub is_properly_intersecting {
    ! $_[0]->is_disjoint($_[1])
      && $_[0]->difference($_[1])->size
      && $_[1]->difference($_[0])->size
}

sub difference { $_[0]->clone->remove(keys %{$_[1]}) }

sub union {
    my $class = ref $_[0];
    return $class->new( keys %{$_[0]}, keys %{$_[1]} );
}

sub intersection { $_[0]->difference( $_[0]->clone->difference($_[1]) ) }

sub symmetric_difference { $_[0]->clone->invert(keys %{$_[1]}) }

{
    *copy = \&clone;
    *has = \&contains;
    *member = \&element;
    *members = \&elements;
    *delete = \&remove;
    *is_empty = \&is_null;
    *unique = \&symmetric_difference;
}

1;

__END__

=head1 NAME

Set::Tiny - Simple sets of strings

=head1 VERSION

Version 0.01

=head1 SYNOPSIS

    use Set::Tiny;

    my $s1 = Set::Tiny->new(qw( a b c ));
    my $s2 = Set::Tiny->new(qw( b c d ));

    my $u  = $s1->union($s2);
    my $i  = $s1->intersection($s2);
    my $s  = $s1->symmetric_difference($s2);

    print $u->as_string; # (a b c d)
    print $i->as_string; # (b c)
    print $s->as_string; # (a d)

    print "i is a subset of s1"   if $i->is_subset($s1);
    print "u is a superset of s1" if $u->is_superset($s1);

=head1 DESCRIPTION

Set::Tiny is a thin wrapper around regular Perl hashes to perform often needed
set operations, such as testing two sets of strings for equality, or checking
whether one is contained within the other.

For a more complete implementation of mathematical set theory, see
L<Set::Scalar>. For sets of arbitrary objects, see L<Set::Object>.

=head2 Why Set::Tiny?

=over

=item Convenience

Set::Tiny aims to provide a convenient interface to commonly used set
operations, which you would usually implement using regular hashes and a couple
of C<for> loops (in fact, that's exactly what Set::Tiny does).

=item Speed

The price in performance you pay for this convenience when using a
full-featured set implementation like L<Set::Scalar> is way too high if you
don't actually need the advanced functionality it offers.
Run F<examples/benchmark.pl> for a (non-representative) comparison
between different C<Set::> modules.

=item Ease of use

L<Set::Object> offers better performance than L<Set::Scalar>, but needs a C
compiler to install. Set::Tiny has no dependencies and contains no C code.

=back

=head1 METHODS

Note that all methods that expect a I<list> of set elements stringify
their arguments before inserting them into the set.

=head2 new( [I<list>] )

Class method. Returns a new Set::Tiny object, initialized with the strings in
I<list>, or the empty set if I<list> is empty.

=head2 clone

=head2 copy

Returns a new set with the same elements as this one.

=head2 insert( [I<list>] )

Inserts the elements in I<list> into the set.

=head2 delete( [I<list>] )

=head2 remove( [I<list>] )

Removes the elements in I<list> from the set. Elements that are not
members of the set are ignored.

=head2 invert( [I<list>] )

For each element in I<list>, if it is already a member of the set,
deletes it from the set, else insert it into the set.

=head2 clear

Removes all elements from the set.

=head2 as_string

Returns a string representation of the set.

=head2 elements

=head2 members

Returns the (unordered) list of elements.

=head2 size

Returns the number of elements.

=head2 has( [I<list>] )

=head2 contains( [I<list>] )

Returns true if B<all> of the elements in I<list> are members of the set. If
I<list> is empty, returns true.

=head2 element( [I<string>] )

=head2 member( [I<string>] )

Returns the string if it is contained in the set.

=head2 is_null

=head2 is_empty

Returns true if the set is the empty set.

=head2 union( I<set> )

Returns a new set containing both the elements of this set and I<set>.

=head2 intersection( I<set> )

Returns a new set containing the elements that are present in both this
set and I<set>.

=head2 difference( I<set> )

Returns a new set containing the elements of this set with the elements
of I<set> removed.

=head2 unique( I<set> )

=head2 symmetric_difference( I<set> )

Returns a new set containing the elements that are present in either this set
or I<set>, but not in both.

=head2 is_equal( I<set> )

Returns true if this set contains the same elements as I<set>.

=head2 is_disjoint( I<set> )

Returns true if this set has no elements in common with I<set>. Note that the
empty set is disjoint to any other set.

=head2 is_properly_intersecting( I<set> )

Returns true if this set has elements in common with I<set>, but both
also contain elements that they have not in common with each other.

=head2 is_proper_subset( I<set> )

Returns true if this set is a proper subset of I<set>.

=head2 is_proper_superset( I<set> )

Returns true if this set is a proper superset of I<set>.

=head2 is_subset( I<set> )

Returns true if this set is a subset of I<set>.

=head2 is_superset( I<set> )

Returns true if this set is a superset of I<set>.

=head1 AUTHOR

Stanis Trendelenburg, C<< <stanis.trendelenburg at gmail.com> >>

=head1 CREDITS

Thanks to Adam Kennedy for advice on how to make this module C<Tiny>.

=head1 BUGS

Please report any bugs or feature requests to C<bug-set-tiny at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Set-Tiny>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 COPYRIGHT & LICENSE

Copyright 2009 Stanis Trendelenburg, all rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=head1 SEE ALSO

L<Set::Scalar>, L<Set::Object>