Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Type::Tiny 1.2.0 Released

by tobyink (Abbot)
on Jun 01, 2017 at 10:44 UTC ( #1191825=perlnews: print w/replies, xml ) Need Help??

So, Type::Tiny 1.2.0 (a.k.a. 1.002000 using Perlish decimals) is now available on CPAN.

Highlights since 1.0.0:

  • Type::Params now has compile_named and validate_named.

    This allows for:

    sub add_pet { state $check = compile_named( name => Str, species => Str, age => Optional[Int], ); my $args = $check->(@_); ...; # do stuff with $args hashref }

    It's faster than the old compile slurpy Dict hack.

  • Type::Tiny's constraint parameter may be a string of code.

    isa => Int->where('$_ % 2 == 0')  # even numbers only
  • Types::Standard::CycleTuple added.

    my $type = CycleTuple[Str, ArrayRef, Int]; $type->assert_valid( [ "foo", [], 42, "bar", [], 21 ] ); # ok $type->assert_valid( [ "foo", [], 42, "bar", [], 2.1 ] ); # throws exc +eption
  • Types::Standard::RegexpRef now accepts blessed objects where $object->isa('Regexp'). This plays better with re::engine::* pragmas.

  • Fixed bug where Types::Standard::Int would sometimes accept an overloaded object. (It never should.)

  • Various performance enhancements and bug fixes.

Replies are listed 'Best First'.
Re: Type::Tiny 1.2.0 Released
by 1nickt (Monsignor) on Jun 01, 2017 at 12:17 UTC

    Awesome! Thanks, Toby. I use this every day of my life.

    The way forward always starts with a minimal test.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2018-08-22 02:07 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (204 votes). Check out past polls.