Toby Inkster
  • Open Source
  • Portfolio
  • Hire
  • Blog
  • Contact
Home » Blog » tricks

Tag: tricks

Type::Tiny Tricks #7: Tricks with Dicts

Date: 23/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-7-tricks-with-dicts.html

In Perl, hashes are typically used for two sorts of purposes: maps (where the hash key acts as an object identifier) and dictionaries (where the hash key acts like a field name). A quick illustration of what I mean…

Type::Tiny Tricks #6: Tricks with Tuples

Date: 22/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-6-tricks-with-tuples.html

Let's say you want an attribute to accept a pair of numbers – perhaps a geographic co-ordinates [ 50.873, -0.002 ]. You could constrain the attribute as ArrayRef[Num], but that would accept an arrayref containing a single number, or…

Type::Tiny Tricks #5: Wrapping Moose/Mouse Type Constraints

Date: 21/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-5-wrapping-moosemouse-type-constraints.html

So you have this Moo class, and it turns out what you really need for it is the StrictVersionStr type constraint defined in MooseX::Types::Perl. You could switch the class to Moose, but long term you want to stick with…

Type::Tiny Tricks #4: Inlined Type Constraints

Date: 20/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-4-inlined-type-constraints.html

Type::Tiny Tricks #3: One-off Coercions

Date: 19/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-3-one-off-coercions.html

Type::Tiny Tricks #2: Types Are Objects

Date: 18/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-2-types-are-objects.html

Type::Tiny Tricks #1: Quick Intersections

Date: 17/08/2014
Original: http://blogs.perl.org/users/toby_inkster/2014/08/typetiny-tricks-1-quick-intersections.html

Recent Blog Posts

  • Mood Lighting
  • Happy New Year
  • Dummy’s Guide to Roots Sage Theme in WordPress
  • WordPress wp-ctrl-semicolon Plugin
  • Thank You, Coveralls.io
  • Finding Squares in Matrices

Copyright © 1999–2021 Toby Inkster. All rights reserved.

Toby Ink Ltd is a registered company in England and Wales with company number 12533297.