/usr/share/perl5/Redis/List.pm is in libredis-perl 2:1.9910-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 | #
# This file is part of Redis
#
# This software is Copyright (c) 2015 by Pedro Melo, Damien Krotkine.
#
# This is free software, licensed under:
#
# The Artistic License 2.0 (GPL Compatible)
#
package Redis::List;
$Redis::List::VERSION = '1.991';
# ABSTRACT: tie Perl arrays to Redis lists
# VERSION
# AUTHORITY
use strict;
use warnings;
use base qw/Redis Tie::Array/;
sub TIEARRAY {
my ($class, $list, @rest) = @_;
my $self = $class->new(@rest);
$self->{list} = $list;
return $self;
}
sub FETCH {
my ($self, $index) = @_;
$self->lindex($self->{list}, $index);
}
sub FETCHSIZE {
my ($self) = @_;
$self->llen($self->{list});
}
sub STORE {
my ($self, $index, $value) = @_;
$self->lset($self->{list}, $index, $value);
}
sub STORESIZE {
my ($self, $count) = @_;
$self->ltrim($self->{list}, 0, $count);
# if $count > $self->FETCHSIZE;
}
sub CLEAR {
my ($self) = @_;
$self->del($self->{list});
}
sub PUSH {
my $self = shift;
my $list = $self->{list};
$self->rpush($list, $_) for @_;
}
sub POP {
my $self = shift;
$self->rpop($self->{list});
}
sub SHIFT {
my ($self) = @_;
$self->lpop($self->{list});
}
sub UNSHIFT {
my $self = shift;
my $list = $self->{list};
$self->lpush($list, $_) for @_;
}
sub SPLICE {
my ($self, $offset, $length) = @_;
$self->lrange($self->{list}, $offset, $length);
# FIXME rest of @_ ?
}
sub EXTEND {
my ($self, $count) = @_;
$self->rpush($self->{list}, '') for ($self->FETCHSIZE .. ($count - 1));
}
sub DESTROY { $_[0]->quit }
1; ## End of Redis::List
__END__
=pod
=encoding UTF-8
=head1 NAME
Redis::List - tie Perl arrays to Redis lists
=head1 VERSION
version 1.991
=head1 SYNOPSYS
tie @my_list, 'Redis::List', 'list_name', @Redis_new_parameters;
$value = $my_list[$index];
$my_list[$index] = $value;
$count = @my_list;
push @my_list, 'values';
$value = pop @my_list;
unshift @my_list, 'values';
$value = shift @my_list;
## NOTE: fourth parameter of splice is *NOT* supported for now
@other_list = splice(@my_list, 2, 3);
@my_list = ();
=head1 AUTHORS
=over 4
=item *
Pedro Melo <melo@cpan.org>
=item *
Damien Krotkine <dams@cpan.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Pedro Melo, Damien Krotkine.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=cut
|