The code in Attean::API::Iterator::map attempts to set the item_type and variables based on the underlying iterator. But if the map block changes the type of objects being returned, the item_type may be wrong, leading to runtime errors. For example:
my $iter = $model->get_quads()->map(sub { shift->subject });
This will lead to errors such as:
CodeIterator item is not a Attean::API::Quad: Attean::IRI=HASH(0x7f935007eab8) at lib/Attean/CodeIterator.pm line 88.
The code in
Attean::API::Iterator::map
attempts to set theitem_type
andvariables
based on the underlying iterator. But if themap
block changes the type of objects being returned, theitem_type
may be wrong, leading to runtime errors. For example:This will lead to errors such as: