in reply to RFC: Spreadsheet::ParseExcel::Stream

The main drawback to the Spreadsheet::ParseExcel callback interface is that it gets called for every cell. It would be nice if the callbacks could process the data row by row (when desired). So here is an implementation that does that. And it has the advantage over the OP that no Coro is necessary:
package Spreadsheet::ParseExcel::CB; use strict; use warnings; use Spreadsheet::ParseExcel; sub new { my $class = shift; my %args = @_; my $sheet_f = $args{Sheet}; my $row_f = $args{Row}; bless { Sheet => $sheet_f, Row => $row_f, }, $class; } sub parse { my ($self,$file) = @_; my $row_f = $self->{Row}; my $sheet_f = $self->{Sheet}; my @cells; my $sheet = ''; my ($wb, $idx, $row, $col, $cell); my ($prv_idx, $prv_row) = (-1,-1); my $handler = sub { ($wb, $idx, $row, $col, $cell) = @_; if ( $prv_row >= 0 and ( $row > $prv_row or $idx > $prv_idx ) ) { $row_f->(@cells) if $row_f; @cells = (); } if ($idx > $prv_idx) { if ($sheet_f) { my $ws = $wb->worksheet($idx); $sheet_f->($ws->{Name}, $ws, $wb); } } push @cells, $cell; ($prv_idx, $prv_row) = ($idx, $row); }; my $xls = Spreadsheet::ParseExcel->new( CellHandler => $handler, NotSetCell => 1, ); $xls->Parse($file); # Last row $row_f->(@cells) if $row_f; } 1; ## And some sample code: #!/usr/bin/perl use strict; use warnings; use Spreadsheet::ParseExcel::CB; my $name; my $process_row = sub { my @vals = map $_->value(), @_; print "$name: @vals\n"; }; my $process_sheet = sub { $name = shift; print "Sheet: $name\n"; }; my $xls = PM::ParseExcel::CB->new( Row => $process_row, Sheet => $process_sheet, ); $xls->parse('spreadsheet.xls')