Skip to content

Instantly share code, notes, and snippets.

Avatar

Hauke D haukex

View GitHub Profile
View gist:07006f02a3f7b9f07108af455b217894
# Looks like overloaded &{} doesn't work with after_parse in either of Text::CSV_{PP,XS}
# so need to use \&{...} to get a real coderef. That's not a huge problem.
# This will die on any row that breaks the constraint...
after_parse => \&{ Tuple[Str, Str, Int, Bool, Optional[Num]] }
# This will skip on any row that breaks the constraint...
after_parse => sub {
state $type = Tuple[Str, Str, Int, Bool, Optional[Num]];
state $check = $type->compiled_check;