List::Sliding::Changes

Extract new elements from a sliding window
Download

List::Sliding::Changes Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Max Maischein
  • Publisher web site:
  • http://search.cpan.org/~corion/

List::Sliding::Changes Tags


List::Sliding::Changes Description

Extract new elements from a sliding window List::Sliding::Changes is a Perl module that allows you to easily find elements that were appended to one of two lists. It is intended to faciliate processing wherever you don't have a log but only a sliding window for events, such as a status window which only displays the 20 most recent events, without timestamp.The module assumes that the update frequency is high and will always respect the longest overlap between the two sequences. To be a bit faster with long lists, it searches the first list from the end, assuming that the first list will be much longer than the second list.SYNOPSIS use strict; use Tie::File; use List::Sliding::Changes qw(find_new_elements); my $filename = 'log.txt'; my @log; tie @log, 'Tie::File', $filename or die "Couldn't tie to $filename : $!\n"; # See what has happened since we last polled my @status = get_last_20_status_messages(); # Find out what we did not already communicate my (@new) = find_new_elements(\@log,\@status); print "New log messages : $_\n" for (@new); # And update our log with what we have seen push @log, @new; Requirements: · Perl


List::Sliding::Changes Related Software