in reply to Re: RFC: DBIx::Iterator
in thread RFC: DBIx::Iterator

Just for fun, here is a completely runnable abstract example that doesn't use SQL at all, we are instead iterating over various lists that sort of simulate selecting a single column from several joined tables (No, you probably wouldn't really want to do this sort of hard coded list iterator this way, but it would be a good way to splice in hardcoded lists as sort of a Cartesian join on some SQL when combined with the SQL iterators):
use strict; use warnings; use DBIx::Iterator qw(mk_iterator list_iterator); my $iter = mk_iterator( \&list_123, [ \&list_abc, \&list_def, ], [ \&list_456, \&list_789, ], ); use Data::Dumper qw(Dumper); while ( my $r = $iter->() ) { print Dumper($r); } sub list_ab { my $x = shift; my $y = shift; list_iterator( LIST => [ map {[$_]} $x..$y ], SELECT => [ "$x$y" ], @_, ) } sub list_123 { list_ab(1,3,@_) } sub list_456 { list_ab(4,6,@_) } sub list_789 { list_ab(7,9,@_) } sub list_abc { list_ab("a","c",@_) } sub list_def { list_ab("d","f",@_) }