Thanks!
The nature of the algorithm requires that the data end up in arrays. So supporting iterators would just be bolted on to the front. So for the case of file handles, you might as well just use:
my $diff = Algorithm::Diff->new( [<IN1>], [<IN2>] );
as that will be as efficient as possible.
For the case of other iterators, you might as well provide a general "iterate into a list" procedure that has nothing to do with Algorithm::Diff, for example:
so:sub cvIterToList { my $cvIter = shift( @_ ); my @list; my $item; while( defined( $item= $cvIter->() ) ) { push @list, $item; } return \@list; }
my $diff = Algorithm::Diff->new( cvIterToList($iter), [<IN>] );
But I could certainly add such to A::Diff anyway. What other types of iterators should I support? Perhaps that is enough since other cases can be covered simply enough with something like:
cvIterToList( sub { $obj->Next() } )
- tye
In reply to Re^2: OO Algorithm::Diff (finally) released (iterators)
by tye
in thread OO Algorithm::Diff (finally) released
by tye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |