Michael Shipper
and 1 contributors


Data::Range::Compare::Stream::Iterator::File::MergeSortAsc::Stack - On Disk Stack


  use Data::Range::Compare::Stream::Iterator::File::MergeSortAsc::Stack;

  my $stack=new Data::Range::Compare::Stream::Iterator::File::MergeSortAsc::Stack;

  $stack->push('some string');

  while($stack->has_next) {
    my $next=$stack->get_next;
    print $next,"\n";


This is a very simple module that handles data pushed onto the stack in temp files. At runtime 2 temp files are created: One for reading one for writing. When the read file is exausted it is deleted and the write file becomes the new read file, at wich point a new write file is created and the process starts over again. All temp files are deleted when the object passes out of scope.

OO Methods

  • my $stack=new Data::Range::Compare::Stream::Iterator::File::MergeSortAsc::Stack;

    Instance constructor takes one optional argument:

          # tmpdir is defined its value is passed to to File::Temp->new(DIR=>$self->{tmpdir});
  • while(my $state=$stack->has_next) { ... }

    Returns true of there are more elements on the stack. $state can be one of 3 values: 0 indicates stack is empty, 1 indicates there is only one element left on the stack, 2 indicates there are 2 or more objects left on the stack.

  • my $next=$stack->get_next;

    Returns the next value from the stack if $stack->get_next is true.

  • $stack->push('some string');

    Pushes the string onto the stack.

  • my $fh=$stack->get_temp;

    Returns a temporary file created from File::Temp->new;




Michael Shipper

Source-Forge Project

As of version 0.001 the Project has been moved to Source-Forge.net

Data Range Compare https://sourceforge.net/projects/data-range-comp/


Copyright 2011 Michael Shipper. All rights reserved.

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