Type::Tiny 1.8.0 (1.008000) was released today.

The new features are pretty minor. Most of the improvements are in documentation and testing.

Replies are listed 'Best First'.
Re: Type::Tiny 1.8.0 released
by haukex (Bishop) on Dec 12, 2019 at 20:47 UTC

    Thank you for this, I was just considering how I'd implement CSV input data validation in some code I'll be writing soon, and your post reminded me that I can do that with Type::Params :-)

      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.

        Thanks, good point! I'll probably be customizing some of the constraints, it's mostly numeric types (that can sometimes be NaN) where I want to code defensively and check that their length and precision isn't doing anything strange. This is for importing CSV files (measurement data from various dataloggers) to a database, and exporting them again, and I figured it'd be easier and more flexible for me to implement the detailed type constraints in Perl. If I run a benchmark, I'll let you know of the results!

      This and this are thw W3C thoughts on CSV validation. I did not yet find time to implement them.

      Enjoy, Have FUN! H.Merijn

        Very interesting, thanks!