Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterator->map causes an error if the map changes the object type #156

Open
kasei opened this issue Nov 28, 2020 · 0 comments
Open

Iterator->map causes an error if the map changes the object type #156

kasei opened this issue Nov 28, 2020 · 0 comments

Comments

@kasei
Copy link
Owner

kasei commented Nov 28, 2020

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant