[SCM] libtype-tiny-perl Debian packaging branch, master, updated. debian/0.016-1-48-ga7f6748
Toby Inkster
mail at tobyinkster.co.uk
Mon Jul 29 12:54:59 UTC 2013
The following commit has been merged in the master branch:
commit 1b1b640e4711f3be2d540938e3bbddecdbda03e2
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date: Fri Jul 19 08:17:32 2013 +0100
improve message example in manual too
diff --git a/lib/Type/Tiny/Manual/Libraries.pod b/lib/Type/Tiny/Manual/Libraries.pod
index f264281..fff3380 100644
--- a/lib/Type/Tiny/Manual/Libraries.pod
+++ b/lib/Type/Tiny/Manual/Libraries.pod
@@ -145,13 +145,17 @@ L<Type::Tiny::Manual::Coercions>.
It is sometimes nice to be able to emit a more useful error message than
the standard:
- value "Foo" did not pass type constraint "Bar"
+ Value "Foo" did not pass type constraint "Bar"
It is possible to define custom error messages for types.
declare MediumInteger, as Integer,
where { $_ >= 10 and $_ < 20 },
- message { $_ < 10 ? "$_ is too small" : "$_ is too big" };
+ message {
+ return Integer->get_message($_) if !Integer->check($_);
+ return "$_ is too small!" if $_ < 10;
+ return "$_ is so very, very big!";
+ };
=head2 Inlining
--
libtype-tiny-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list