Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Type::Tiny 1.8.0 released

by tobyink (Canon)
on Dec 11, 2019 at 08:13 UTC ( #11109964=perlnews: print w/replies, xml ) Need Help??

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.

  • Totally rewritten manual/tutorial.

  • Every issue on RT has been handled.

  • Bigger test suite. The exact number of tests run varies based on the availability of optional dependencies, but I just ran the test suite with EXTENDED_TESTING set to false and most of the optional dependencies installed, and it was nearly 7500 tests, compared to just over 2700 for Type::Tiny 1.6.0. With EXTENDED_TESTING true, there are nearly 13900 tests.

    This includes a set of tests for each built-in type which are intended to function both as test cases and advanced documentation.

Replies are listed 'Best First'.
Re: Type::Tiny 1.8.0 released
by haukex (Chancellor) 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!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlnews [id://11109964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-03-29 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    To "Disagree to disagree" means to:









    Results (169 votes). Check out past polls.

    Notices?