List::MRU

List::MRU is a Perl module that implements a simple fixed-size MRU-ordered list.
Download

List::MRU Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Gavin Carr
  • Publisher web site:
  • http://search.cpan.org/~gavinc/File-DirCompare-0.3/DirCompare.pm

List::MRU Tags


List::MRU Description

List::MRU is a Perl module that implements a simple fixed-size MRU-ordered list. List::MRU is a Perl module that implements a simple fixed-size MRU-ordered list.SYNOPSIS use List::MRU; # Constructor $lm = List::MRU->new(max => 20); # Constructor with explicit 'eq' subroutine for obj equality tests $lm = List::MRU->new(max => 20, 'eq' => sub { $_->stringify eq $_->stringify }); # Constructor using explicit UUIDs $lm - List::MRU->new(max => 5, uuid => 1); # Add item, moving to head of list if already exists $lm->add($item); # Add item, moving to head of list if $uuid matches or object already exists $lm->add($item, $uuid); # Iterate in most-recently-added order for $item ($lm->list) { print "$itemn"; } # each-style iteration while (($item, $uuid) = $lm->each) { print "$item, $uuidn"; } # Item deletion $lm->delete($item); $lm->delete(uuid => $uuid); # Accessors $max = $lm->max; # max items in list $count = $lm->count; # current items in listPerl module implementing a simple fixed-size most-recently-used- (MRU)-ordered list of values/objects. Well, really it's a most- recently-added list - items added to the list are just promoted to the front of the list if they already exist, otherwise they are added there.Works fine with with non-scalar items, but you will need to supply an explicit 'eq' subroutine to the constructor to handle testing for the 'same' object (or alternatively have overloaded the 'eq' operator for your object).List::MRU also supports having explicit UUIDs attached to items, allowing List::MRU items to be modified, instead of a change just creating a new entry. Requirements: · Perl


List::MRU Related Software