in reply to Re: Type::Tiny 1.8.0 released
in thread Type::Tiny 1.8.0 released
Hmm, yeah, sounds like an interesting use case.
You might not even need Type::Params. The Tuple type from Types::Standard might be sufficient. Something like:
use Types::Standard -types; my $row_type = Tuple[ Str, Str, Int, Bool, Optional[Num] ]; my $row_check = $row_type->compiled_check; while (my $row = $csv->get_line($fh)) { $row_check->($row) or die $row_type->get_message($row); }
If you've got Type::Tiny::XS installed, and your row specification is simple enough, you might even find that $row_type was able to generate $row_check as an xsub. (Off the top of my head, I don't think the one in the example is, as I don't think Optional is implemented in XS yet.)
If you end up with something cool, I would love to see and maybe incorporate it or something like it into the documentation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Type::Tiny 1.8.0 released
by haukex (Archbishop) on Dec 14, 2019 at 20:58 UTC |