Michael Shipper > Data-Range-Compare-Stream > Data::Range::Compare::Stream::Iterator::Validate

Download:
Data-Range-Compare-Stream-4.029.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

Data::Range::Compare::Stream::Iterator::Validate - Iterator Result Validation

SYNOPSIS ^

  use Data::Range::Compare::Stream;
  use Data::Range::Compare::Stream::Iterator::Array;
  use Data::Range::Compare::Stream::Iterator::Validate;
  
  
  my $list=[
    
    # Invalid range 1
    Data::Range::Compare::Stream->new(),

    # Invalid range 2
    Data::Range::Compare::Stream->new(0),
    # Invalid range 3
    Data::Range::Compare::Stream->new(undef,0),
    # Invalid range 4
    Data::Range::Compare::Stream->new(1,0),

    # Valid range 1
    Data::Range::Compare::Stream->new(0,0),

    # Valid range 2
    Data::Range::Compare::Stream->new(1,2),

    # Invalid range 5
    Data::Range::Compare::Stream->new(2,1),
  ];
  
  sub bad_range {
    my ($range)=@_;
    print "Invalid range found\n";
  }
  
  my $it=new Data::Range::Compare::Stream::Iterator::Array(range_list=>$list,sorted=>1);
  
  my $valid=new Data::Range::Compare::Stream::Iterator::Validate($it,on_bad_range=>\&bad_range);
  while($valid->has_next) {
    my $result=$valid->get_next;
    print $result,"\n";
  }

DESCRIPTION ^

This class validates result objects returned from iterators that implement Data::Range::Compare::Stream::Iterator::Base.

How ranges are defined as not valid.

Data::Range::Compare::Stream and all classes that implement have a instance->boolean interface. When the boolean interface returns false the range is considered invalid.

OO Methods

SEE ALSO ^

Data::Range::Compare::Stream::Cookbook

AUTHOR ^

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 ^

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.

syntax highlighting: