develooper Front page | perl.moose | Postings from June 2011

Re: Moose Type Constraints violations to warnings?

Thread Previous | Thread Next
From:
Dave Rolsky
Date:
June 13, 2011 08:36
Subject:
Re: Moose Type Constraints violations to warnings?
Message ID:
alpine.DEB.2.00.1106131034460.339@urth.org
On Mon, 13 Jun 2011, Ovid wrote:

> I don't want to turn off the type checks. I would just like some of them to be warnings if we're in production.
>
> I agree completely with the *concept* of the strict type constraints, but 
>
>
>   "In theory, theory and practice are the same.
>   In practice, we're trying to comb spaghetti."
>   Abraham Lincoln, 1912 speech to the Republican Women's De-emancipation Convention
>
> If a hotel's "short description" must be no longer than 200 characters, 
> they would much prefer to have the first 200 characters of their hotel's 
> 250-character description displayed rather than nothing.

You can use coercions to do this, can't you? You could even warn inside 
the coercion.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About