[SCM] libtype-tiny-perl Debian packaging branch, master, updated. debian/0.000_12-1-8-g26b4343
Jonas Smedegaard
dr at jones.dk
Fri Apr 19 10:01:38 UTC 2013
The following commit has been merged in the master branch:
commit f31099db10f0107e68302d83352ee2cc28333731
Author: Jonas Smedegaard <dr at jones.dk>
Date: Fri Apr 19 11:32:10 2013 +0200
Imported Upstream version 0.001
diff --git a/COPYRIGHT b/COPYRIGHT
index 20108aa..1da800c 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -6,7 +6,6 @@ Source: https://metacpan.org/release/Type-Tiny
Files: examples/benchmark-coercions.pl
examples/benchmark-constraints.pl
examples/datetime-coercions.pl
- inc/Module/Install/Contributors.pm
lib/Test/TypeTiny.pm
lib/Type/Coercion.pm
lib/Type/Coercion/Union.pm
@@ -66,22 +65,19 @@ Files: CONTRIBUTING
CREDITS
Changes
LICENSE
- MANIFEST.SKIP
META.ttl
Makefile.PL
NEWS
README
TODO
TODO.mm
- inc/Test/Fatal.pm
- inc/Test/Requires.pm
- inc/Try/Tiny.pm
meta/changes.pret
meta/doap.pret
meta/makefile.pret
meta/people.pret
-Copyright: Unknown
-License: Unknown
+ meta/rights.pret
+Copyright: Copyright 2013 Toby Inkster.
+License: GPL-1.0+ or Artistic-1.0
Files: inc/Module/Install.pm
inc/Module/Install/Include.pm
@@ -98,6 +94,10 @@ Files: inc/Module/Install/Makefile.pm
Copyright: Copyright 2002, 2003, 2004 Audrey Tang and Brian Ingerson.
License: GPL-1.0+ or Artistic-1.0
+Files: inc/Try/Tiny.pm
+Copyright: Copyright 2013 Yuval Kogman.
+License: GPL-1.0+ or Artistic-1.0
+
Files: COPYRIGHT
Copyright: None
License: public-domain
@@ -107,10 +107,22 @@ Files: inc/Module/Install/Package.pm
Copyright: Copyright (c) 2011. Ingy doet Net.
License: GPL-1.0+ or Artistic-1.0
+Files: inc/Test/Requires.pm
+Copyright: Copyright 2013 MATSUNO Tokuhiro.
+License: GPL-1.0+ or Artistic-1.0
+
+Files: inc/Test/Fatal.pm
+Copyright: Copyright 2013 Ricardo Signes.
+License: GPL-1.0+ or Artistic-1.0
+
Files: inc/Module/Install/Base.pm
Copyright: Copyright 2003, 2004 by Audrey Tang <autrijus at autrijus.org>.
License: GPL-1.0+ or Artistic-1.0
+Files: MANIFEST.SKIP
+Copyright: Copyright 2013 Ingy döt Net.
+License: GPL-1.0+ or Artistic-1.0
+
Files: inc/YAML/Tiny.pm
Copyright: Copyright 2006 - 2012 Adam Kennedy.
License: GPL-1.0+ or Artistic-1.0
diff --git a/Changes b/Changes
index e300b3b..c9bdc80 100644
--- a/Changes
+++ b/Changes
@@ -6,6 +6,20 @@ Home page: <https://metacpan.org/release/Type-Tiny>
Bug tracker: <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>
Maintainer: Toby Inkster <mailto:tobyink at cpan.org>
+0.001 2013-04-15 # First public release
+
+ - (Addition) More test cases for Optional[`a] within Dict[`a].
+ - (Bugfix) Some inline code assumed that it would be compiled in a package
+ that had 'blessed' imported.
+ - (Bugfix) Some inline code wasn't wrapped in parentheses.
+ - (Documentation) Minor improvements.
+ - Improve test names generated by Test::TypeTiny; allow test scripts to
+ provide test names.
+ - Parameterized type constraints in Types::Standard now do some sanity
+ checking on their arguments.
+ - Weaken the reference from a Moose::Meta::TypeConstraint object to its
+ Type::Tiny origin.
+
0.000_12 2013-04-12
- (Documentation) Fix minor typo.
@@ -13,9 +27,8 @@ Maintainer: Toby Inkster <mailto:tobyink at cpan.org>
0.000_11 2013-04-11
- (Bugfix) Fix prototype for Type::Utils::as.
- - BIG, AWESOME CHANGE: no longer need to pass '-moose' parameter when
- importing a library into a Moose class; only Mouse needs that treatment
- now.
+ - No longer need to pass '-moose' parameter when importing a library into
+ a Moose class; only Mouse needs that treatment now.
0.000_10 2013-04-09
diff --git a/MANIFEST b/MANIFEST
index 0ec1a23..f7cfb6a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -11,7 +11,6 @@ inc/Module/Install/AutoInstall.pm
inc/Module/Install/AutoManifest.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
-inc/Module/Install/Contributors.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Include.pm
inc/Module/Install/Makefile.pm
@@ -54,6 +53,7 @@ meta/changes.pret
meta/doap.pret
meta/makefile.pret
meta/people.pret
+meta/rights.pret
NEWS
README
t/00-compile.t
diff --git a/META.ttl b/META.ttl
index 1b332ae..d60d6ac 100644
--- a/META.ttl
+++ b/META.ttl
@@ -36,6 +36,14 @@ dist:project
];
dc:contributor cpan:tobyink;
doap:bug-database <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>;
+ doap:category [ rdfs:label "Moo" ];
+ doap:category [ rdfs:label "Moose" ];
+ doap:category [ rdfs:label "Mouse" ];
+ doap:category [ rdfs:label "Type Constraint" ];
+ doap:category [ rdfs:label "Type Coercion" ];
+ doap:category [ rdfs:label "Type Library" ];
+ doap:category [ rdfs:label "Schema" ];
+ doap:category [ rdfs:label "Validation" ];
doap:created "2013-03-23"^^xsd:date;
doap:developer cpan:tobyink;
doap:download-page <https://metacpan.org/release/Type-Tiny>;
@@ -55,6 +63,7 @@ dist:project
doap:release dist:v_0-000_10;
doap:release dist:v_0-000_11;
doap:release dist:v_0-000_12;
+ doap:release dist:v_0-001;
doap:repository [
a doap:HgRepository;
doap:browse <https://bitbucket.org/tobyink/p5-type-tiny>;
@@ -381,7 +390,7 @@ dist:v_0-000_11
];
dcs:item [
a dcs:Change;
- rdfs:label "BIG, AWESOME CHANGE: no longer need to pass '-moose' parameter when importing a library into a Moose class; only Mouse needs that treatment now.";
+ rdfs:label "No longer need to pass '-moose' parameter when importing a library into a Moose class; only Mouse needs that treatment now.";
];
];
dcs:released-by cpan:tobyink;
@@ -403,12 +412,69 @@ dist:v_0-000_12
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_12.tar.gz>;
doap:revision "0.000_12"^^xsd:string.
+dist:v_0-001
+ a doap:Version;
+ rdfs:label "First public release";
+ dc:identifier "Type-Tiny-0.001"^^xsd:string;
+ dc:issued "2013-04-15"^^xsd:date;
+ dcs:changeset [
+ dcs:item [
+ a dcs:Documentation;
+ rdfs:label "Minor improvements.";
+ ];
+ dcs:item [
+ a dcs:Bugfix;
+ rdfs:label "Some inline code assumed that it would be compiled in a package that had 'blessed' imported.";
+ ];
+ dcs:item [
+ a dcs:Bugfix;
+ rdfs:label "Some inline code wasn't wrapped in parentheses.";
+ ];
+ dcs:item [
+ a dcs:Addition;
+ rdfs:label "More test cases for Optional[`a] within Dict[`a].";
+ ];
+ dcs:item [
+ a dcs:Change;
+ rdfs:label "Weaken the reference from a Moose::Meta::TypeConstraint object to its Type::Tiny origin.";
+ ];
+ dcs:item [
+ a dcs:Change;
+ rdfs:label "Parameterized type constraints in Types::Standard now do some sanity checking on their arguments.";
+ ];
+ dcs:item [
+ a dcs:Change;
+ rdfs:label "Improve test names generated by Test::TypeTiny; allow test scripts to provide test names.";
+ ];
+ ];
+ dcs:released-by cpan:tobyink;
+ doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.001.tar.gz>;
+ doap:revision "0.001"^^xsd:string.
+
+cpan:ingy
+ a foaf:Person;
+ foaf:name "Ingy d\u00F6t Net";
+ foaf:nick "INGY";
+ foaf:page <https://metacpan.org/author/INGY>.
+
cpan:mstrout
a foaf:Person;
foaf:name "Matt S Trout";
foaf:nick "MSTROUT";
foaf:page <https://metacpan.org/author/MSTROUT>.
+cpan:nuffin
+ a foaf:Person;
+ foaf:name "Yuval Kogman";
+ foaf:nick "NUFFIN";
+ foaf:page <https://metacpan.org/author/NUFFIN>.
+
+cpan:rjbs
+ a foaf:Person;
+ foaf:name "Ricardo Signes";
+ foaf:nick "RJBS";
+ foaf:page <https://metacpan.org/author/RJBS>.
+
cpan:tobyink
a foaf:Person;
foaf:name "Toby Inkster";
@@ -416,6 +482,139 @@ cpan:tobyink
foaf:nick "TOBYINK";
foaf:page <https://metacpan.org/author/TOBYINK>.
+cpan:tokuhirom
+ a foaf:Person;
+ foaf:name "MATSUNO Tokuhiro";
+ foaf:nick "TOKUHIROM";
+ foaf:page <https://metacpan.org/author/TOKUHIROM>.
+
<http://dev.perl.org/licenses/>
dc:title "the same terms as the perl 5 programming language system itself".
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "CONTRIBUTING".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "CREDITS".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:TextDocument;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "Changes".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:TextDocument;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "LICENSE".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "META.ttl".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:SourceCode;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "Makefile.PL";
+ nfo:programmingLanguage "Perl".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:TextDocument;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "NEWS".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:TextDocument;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "README".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:TextDocument;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "TODO".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "TODO.mm".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "meta/changes.pret".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "meta/doap.pret".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "meta/makefile.pret".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "meta/people.pret".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tobyink;
+ nfo:fileName "meta/rights.pret".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:SourceCode;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:rjbs;
+ nfo:fileName "inc/Test/Fatal.pm";
+ nfo:programmingLanguage "Perl".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:SourceCode;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:tokuhirom;
+ nfo:fileName "inc/Test/Requires.pm";
+ nfo:programmingLanguage "Perl".
+
+[]
+ a nfo:FileDataObject;
+ a nfo:SourceCode;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:nuffin;
+ nfo:fileName "inc/Try/Tiny.pm";
+ nfo:programmingLanguage "Perl".
+
+[]
+ a nfo:FileDataObject;
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:ingy;
+ nfo:fileName "MANIFEST.SKIP".
+
diff --git a/META.yml b/META.yml
index 324635c..ca403c4 100644
--- a/META.yml
+++ b/META.yml
@@ -10,7 +10,15 @@ configure_requires:
distribution_type: module
dynamic_config: 0
generated_by: 'Module::Install version 1.06'
-keywords: []
+keywords:
+ - Moo
+ - Moose
+ - Mouse
+ - Schema
+ - 'Type Coercion'
+ - 'Type Constraint'
+ - 'Type Library'
+ - Validation
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -30,6 +38,4 @@ resources:
homepage: https://metacpan.org/release/Type-Tiny
license: http://dev.perl.org/licenses/
repository: https://bitbucket.org/tobyink/p5-type-tiny
-version: 0.000_12
-x_contributors:
- - 'Matt S Trout <MSTROUT at cpan.org>'
+version: 0.001
diff --git a/NEWS b/NEWS
index c5c4c22..98507cb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-2013-04-XX Type-Tiny version 0.001 released!
+2013-04-15 Type-Tiny version 0.001 released!
- Contains over 2000 lines of code, over 3000 lines of documentation,
and over 650 tests.
diff --git a/README b/README
index 7752d6d..648a14a 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ SYNOPSIS
package Bullwinkle {
use Moose;
- has favourite_number => (is => "ro", isa => $NUM->moose_type);
+ has favourite_number => (is => "ro", isa => $NUM);
}
package Maisy {
@@ -113,6 +113,11 @@ DESCRIPTION
Generally speaking this attribute should not be passed to the
constructor; you should rely on the default lazily-built objects.
+ It should rarely be necessary to obtain a
+ Moose::Meta::TypeConstraint object from Type::Tiny because the
+ Type::Tiny object itself should be usable pretty much anywhere a
+ Moose::Meta::TypeConstraint is expected.
+
The following additional attributes are used for parameterizable (e.g.
"ArrayRef") and parameterized (e.g. "ArrayRef[Int]") type constraints.
Unlike Moose, these aren't handled by separate subclasses.
@@ -267,7 +272,7 @@ SEE ALSO
Type::Library, Type::Utils, Types::Standard, Type::Coercion.
Type::Tiny::Class, Type::Tiny::Role, Type::Tiny::Duck, Type::Tiny::Enum,
- Type::Tiny::Union.
+ Type::Tiny::Union, Type::Tiny::Intersection.
Moose::Meta::TypeConstraint, Mouse::Meta::TypeConstraint.
diff --git a/SIGNATURE b/SIGNATURE
index 774596d..e5d2263 100644
--- a/SIGNATURE
+++ b/SIGNATURE
@@ -15,18 +15,18 @@ not run its Makefile.PL or Build.PL.
Hash: SHA1
SHA1 f983c18fdb491c4b733235d54e8ca7563b67a6a3 CONTRIBUTING
-SHA1 6a8029e67d42627fbeb17e06ffb3b0a56cfe7848 COPYRIGHT
+SHA1 30c00b56ebc663a9b2461edfd5962a386533f2dd COPYRIGHT
SHA1 85619fd047875e0f73e145ce3dd257466152282f CREDITS
-SHA1 a4d45a187e25830e1ec6d9cf95df7008885b9938 Changes
+SHA1 6f026f93099b70c9df0b416b9d3b3b4894de676b Changes
SHA1 937d452c5c4069f4cda9ffaf45a33f1eb5f060e8 LICENSE
-SHA1 34a4c14f04a23bd040e06a0087221a44fa25219d MANIFEST
-SHA1 fbcd2473cc4fecfd250625930d076cd8e42bcebd META.ttl
-SHA1 c680abf94b33d78f6e96b8a42c7b0177b2ec46f2 META.yml
+SHA1 c89aca6b6b31eec52f11dfae2343a4451817e550 MANIFEST
+SHA1 1c481cee3e7321842ceaa4d3f01b6641bc907807 META.ttl
+SHA1 f9c5d0c4f612a9d68a8f2690a2cd7cefc9e6c866 META.yml
SHA1 e1bc19b712df138f9088b140d73a5372e0c3ba12 Makefile.PL
-SHA1 4dfd23b171244b52b9d28cd94a5a91d8b9cb1e4a NEWS
-SHA1 172a6af5e2c2448e11ea762b7614c379a1c05d34 README
-SHA1 d2068d6359400df1b09e5c93f5a58d0e8715eb13 TODO
-SHA1 f61643dad266b0f3df5b6535dd8ce8c6bab2aa97 TODO.mm
+SHA1 972e88dc55325cd2c1bb25f1c52b7cff3abfb622 NEWS
+SHA1 455ab9ddcd888f7692fb118d6f4cbd626ca6df06 README
+SHA1 e9bbdc9af497daa21deef5bf605609feb1864349 TODO
+SHA1 f857afbe459d89cb5a7b643d01e949938e64c78a TODO.mm
SHA1 88ed92a833b81d179b9fcda10d179915c4434c0f examples/benchmark-coercions.pl
SHA1 fce9bfec5f7f783c94dd86a4b19cbf44ebe190bb examples/benchmark-constraints.pl
SHA1 1ec446214f4926f76b14c1d7f098a6d977829229 examples/datetime-coercions.pl
@@ -36,7 +36,6 @@ SHA1 61ab1dd37e33ddbe155907ce51df8a3e56ac8bbf inc/Module/Install/AutoInstall.pm
SHA1 c04f94f91fa97b9f8cfb5a36071098ab0e6c78e3 inc/Module/Install/AutoManifest.pm
SHA1 2d0fad3bf255f8c1e7e1e34eafccc4f595603ddc inc/Module/Install/Base.pm
SHA1 f0e01fff7d73cd145fbf22331579918d4628ddb0 inc/Module/Install/Can.pm
-SHA1 9e4cc10c7f138a3f2c60d9ee1f34261f0d8c5aae inc/Module/Install/Contributors.pm
SHA1 7328966e4fda0c8451a6d3850704da0b84ac1540 inc/Module/Install/Fetch.pm
SHA1 66d3d335a03492583a3be121a7d888f63f08412c inc/Module/Install/Include.pm
SHA1 b62ca5e2d58fa66766ccf4d64574f9e1a2250b34 inc/Module/Install/Makefile.pm
@@ -51,29 +50,30 @@ SHA1 85872fcf275a7868f858ca6ccc0e15cdaff8f8ac inc/Test/Fatal.pm
SHA1 95d4da14025622f3a45f5e9b75b7b6860148f415 inc/Test/Requires.pm
SHA1 75dd349355aff420c46d9e37802e39712b6309c2 inc/Try/Tiny.pm
SHA1 feb933cefe2e3762e8322bd6071a2499f3440da1 inc/YAML/Tiny.pm
-SHA1 9a3c068df59a894a106146d639f1152b17576be3 lib/Test/TypeTiny.pm
-SHA1 f5a34b9c855b0cc966c27d4f64ebf3e1c7b1a636 lib/Type/Coercion.pm
-SHA1 e108bea96431408f2650c8ce5f89b1c157ab25e3 lib/Type/Coercion/Union.pm
-SHA1 2a829f0bab2370c244bb8f96ff2e26e7d1cac676 lib/Type/Library.pm
-SHA1 8605909c596dfda1fd84ef91d62fa35b103f8845 lib/Type/Tiny.pm
-SHA1 cf2e914873bc8a055e04af54d8f1148081d9613a lib/Type/Tiny/Class.pm
-SHA1 cade264432a0c0f447213fbf61f34c12d32b8e8e lib/Type/Tiny/Duck.pm
-SHA1 c2900b2aa3bff28835a1a31c62267fd67090ccd6 lib/Type/Tiny/Enum.pm
-SHA1 1e4eea039b740ecb370e6eac7fa38dcab7e3fc76 lib/Type/Tiny/Intersection.pm
-SHA1 909d7598d16c6321695aaec5a4b6362210f610dc lib/Type/Tiny/Manual.pod
+SHA1 1edf873ee13f9371254aa475e9681c312408ebce lib/Test/TypeTiny.pm
+SHA1 8b30de69cdbd85daad2a1384ee64f7b7fd493694 lib/Type/Coercion.pm
+SHA1 22028dbc3e07d7375a5bdbd386fa5f8e391b51eb lib/Type/Coercion/Union.pm
+SHA1 44a5e58a0152c455ea37e67b5d7366644c56b7e2 lib/Type/Library.pm
+SHA1 fd56160920ad4c5e8aced46df4cfe4ae1b7ad17a lib/Type/Tiny.pm
+SHA1 f09686f8bebd4b3ee8d3c822987919008c80c0a4 lib/Type/Tiny/Class.pm
+SHA1 7463810baf4378e87715f6bde6c987f4c399c0fc lib/Type/Tiny/Duck.pm
+SHA1 1eb88e79fcfc24b56d141f765c8a59c34760b929 lib/Type/Tiny/Enum.pm
+SHA1 6ff5dea287a2768fcfef9bd6b7ec7292b78427da lib/Type/Tiny/Intersection.pm
+SHA1 466efb31f388707f0ae10e2165be256537f56cca lib/Type/Tiny/Manual.pod
SHA1 50c504d45d02457315ff323fed17886607a1731a lib/Type/Tiny/Manual/Libraries.pod
SHA1 4ac320ca2770da01fa84f6235b3eb288a7c97d68 lib/Type/Tiny/Manual/UsingWithMoo.pod
SHA1 340eb0c3619ac2f096e40ec45f828624c89c6b0f lib/Type/Tiny/Manual/UsingWithMoose.pod
SHA1 b8af4b713e5278bfd484739eb07f907c796d9e03 lib/Type/Tiny/Manual/UsingWithMouse.pod
-SHA1 52cf3c559932d0356df02d21e8b93cb96f6cacb1 lib/Type/Tiny/Role.pm
-SHA1 5250f86f6fd5caf9eef82197d27b47613addec97 lib/Type/Tiny/Union.pm
-SHA1 a3c511ffe147d5960a9ef95d812dc40ce59cc23b lib/Type/Utils.pm
-SHA1 8edb4f07df589282a931b44550a63a029b579206 lib/Types/Standard.pm
-SHA1 4dc8c398b8957776d8d9b73bf961bb01f4dbf426 lib/Types/TypeTiny.pm
-SHA1 826db6d75bb20e022ff888bfefa79d61187b76b9 meta/changes.pret
-SHA1 d4abb9a0a9d3f44122fc0a65bdb815b5492c403d meta/doap.pret
+SHA1 3d5aa46bca5acf3d91345e4d03c33b2060a3adcc lib/Type/Tiny/Role.pm
+SHA1 33c0e7e37bdef384582d389b57359f6305d65514 lib/Type/Tiny/Union.pm
+SHA1 5c9b1c90a4bbddcfc91c52d3788b4ca069879ed7 lib/Type/Utils.pm
+SHA1 5a4ca24691cbfa110ef982f9ce88bc67bc6a7f28 lib/Types/Standard.pm
+SHA1 ae23e8c63b6504de4858c657a03dcf99980c2f28 lib/Types/TypeTiny.pm
+SHA1 dd050c5b52a57541c02583fd45df253a5c779678 meta/changes.pret
+SHA1 96293c2090ea5735bf0f2d91a0e25e6209688ccb meta/doap.pret
SHA1 49944647c1c4695a769cb5bdc577f8e63ec8857e meta/makefile.pret
-SHA1 c7f5b2b8dc91525d30b938ae6dfbe61c2a9ea35f meta/people.pret
+SHA1 371e07cf06bca3fd64ac02786319827cc30d6e87 meta/people.pret
+SHA1 6ba0a6e51c478a41b16e1ab4a615e10b776e7ac2 meta/rights.pret
SHA1 da8bcd7d82bd7b49ae48ae36c909be6235817107 t/00-compile.t
SHA1 96a85724daff6e8f04b7194d05e4ab751c13c856 t/arithmetic.t
SHA1 1ef0933cd3d2a51f580bef90a1f21119842b0a29 t/coercion-inlining.t
@@ -97,8 +97,8 @@ SHA1 996a6aabfe5375df3f4e3212ce424f0b55f5b500 t/mouse.t
SHA1 d09b552564513962858c918f6ad25f43d5a471b7 t/stdlib-inlined.t
SHA1 e7ddd8cad949dc66b248a213c5c04c49477c1eaa t/stdlib-overload.t
SHA1 15eea5a85a26a2dc3d508198ef39dff6d7d4efb4 t/stdlib-strmatch.t
-SHA1 f550d0261b572aa387888f55f92eaf6ce2d191cf t/stdlib-structures.t
-SHA1 71a9d552ddf7da011a4a74a2cdd61ffa1de4e47a t/stdlib.t
+SHA1 9022de0b06c66d134043829ca4d5f56395f814f7 t/stdlib-structures.t
+SHA1 b08538ebc5340af9ba079c21bed4db8f882c80b4 t/stdlib.t
SHA1 a8d9f929b9e2ad831953102516bfa8b236027c77 t/syntax.t
SHA1 d568ccf4b7e54dc78391ac1dc86b46d8a46e7154 t/type-class.t
SHA1 3eb8876bb028a0138063a984e5f6eaed5c51e479 t/type-duck.t
@@ -110,7 +110,7 @@ SHA1 6522a316330488fdc29bbc5ede8f381a00276c62 t/type.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
-iEYEARECAAYFAlFnnm8ACgkQzr+BKGoqfTkgUgCgtbuDFD2DMWiNhhIHDOmYPqSj
-aLUAnivJ1Pn/8qTbS/QfwFieevoSCJTp
-=xoPS
+iEYEARECAAYFAlFr9VoACgkQzr+BKGoqfTnx+QCfZ1fGa7scAdh8oVpP+rTJeEWW
+mgwAn2gRpL9k+D5B13bQ2wEPNllUVozK
+=QeEd
-----END PGP SIGNATURE-----
diff --git a/TODO b/TODO
index 57a4ca0..b25337e 100644
--- a/TODO
+++ b/TODO
@@ -4,6 +4,7 @@
* using type constraints from libraries
* creating type constraints using Type::Utils
* coercions
+ * better coercion docs
* integration with MooX-late
* new type constraints for Types::Standard
* Chars - i.e. strings where the UTF-8 bit is on
@@ -13,13 +14,24 @@
* Varchar[length]
* steal from MooseX-Types-Common?
* steal from MooseX-Types-Ro?
+ * OptList[Undef|Ref]
* coercion
* Auto-coercion
- * could do with better tests
* needs documenting
* needs merge with tip
- * need a way of switching this feature on/off?
- * generated coercion functions could maybe be returned as
- thunks?
- * investigate to what extent child types should inherit
- coercions
+ * First-class coercions
+ * moar docs
+ * moar tests
+ * new distribution: Params-Type (name?)
+ * already a first draft (called Type::Check) in p5-type-tiny
+ * documentation
+ * test cases
+ * benchmark versus Params::Validate
+ * much faster, even compared to Params::Validate::XS
+ * improve speed for non-inlineable type constraints coercions
+ * maybe use eval context idea from Type::Check
+ * release 0.001
+ * Mon 15th April?
+ * publish intro blog article
+ * Type-Tiny could be used as a backend for Scalar::Does?
+ * if not, certainly a SEE ALSO
diff --git a/TODO.mm b/TODO.mm
index 5a956c5..cc91e01 100644
--- a/TODO.mm
+++ b/TODO.mm
@@ -7,6 +7,7 @@
<node CREATED="1365159668221" ID="ID_785265846" MODIFIED="1365159675666" TEXT="creating type constraints using Type::Utils"/>
<node CREATED="1365159676662" ID="ID_1609293562" MODIFIED="1365159679179" TEXT="coercions"/>
</node>
+<node CREATED="1365786239957" ID="ID_737542241" LINK="#ID_1260169838" MODIFIED="1365786264896" TEXT="better coercion docs"/>
</node>
<node CREATED="1365159705390" ID="ID_1309512802" MODIFIED="1365534983235" POSITION="left" TEXT="integration with MooX-late"/>
<node CREATED="1365441709337" ID="ID_921538277" MODIFIED="1365534973445" POSITION="right" TEXT="new type constraints for Types::Standard">
@@ -16,17 +17,36 @@
<node CREATED="1365441884333" ID="ID_849860266" MODIFIED="1365441977843" TEXT="Varchar[length]"/>
<node CREATED="1365441979900" ID="ID_1969541225" MODIFIED="1365442361862" TEXT="steal from MooseX-Types-Common?"/>
<node CREATED="1365442342382" ID="ID_345593149" MODIFIED="1365442365283" TEXT="steal from MooseX-Types-Ro?"/>
+<node CREATED="1365880922219" ID="ID_1091298812" MODIFIED="1365880934396" TEXT="OptList[Undef|Ref]"/>
</node>
<node CREATED="1365529954377" ID="ID_1288968569" MODIFIED="1365533825483" POSITION="left" TEXT="coercion">
<node CREATED="1365442049043" ID="ID_1920269603" MODIFIED="1365534968825" TEXT="Auto-coercion">
<font NAME="SansSerif" SIZE="12"/>
-<node CREATED="1365529838164" ID="ID_1740996713" MODIFIED="1365529843768" TEXT="could do with better tests"/>
<node CREATED="1365529844572" ID="ID_700685078" MODIFIED="1365529849044" TEXT="needs documenting"/>
<node CREATED="1365529851374" ID="ID_1411816545" MODIFIED="1365529863215" TEXT="needs merge with tip"/>
-<node CREATED="1365530075403" ID="ID_545406096" MODIFIED="1365530115590" TEXT="need a way of switching this feature on/off?"/>
-<node CREATED="1365530123214" ID="ID_492312961" MODIFIED="1365530179212" TEXT="generated coercion functions could maybe be returned as thunks?"/>
</node>
-<node CREATED="1365529965179" ID="ID_1417745941" MODIFIED="1365530069787" TEXT="investigate to what extent child types should inherit coercions"/>
+<node CREATED="1365785679669" ID="ID_1746990787" MODIFIED="1365785688208" TEXT="First-class coercions">
+<node CREATED="1365785692572" ID="ID_1260169838" MODIFIED="1365785695730" TEXT="moar docs"/>
+<node CREATED="1365785699188" ID="ID_1246464660" MODIFIED="1365785701632" TEXT="moar tests"/>
+</node>
+</node>
+<node CREATED="1365785708936" ID="ID_1388226133" MODIFIED="1365785748089" POSITION="right" TEXT="new distribution: Params-Type (name?)">
+<node CREATED="1365785762582" ID="ID_962609536" MODIFIED="1365785782828" TEXT="already a first draft (called Type::Check) in p5-type-tiny"/>
+<node CREATED="1365785801395" ID="ID_1524020588" MODIFIED="1365785806092" TEXT="documentation"/>
+<node CREATED="1365785808269" ID="ID_307623283" MODIFIED="1365785811103" TEXT="test cases"/>
+<node CREATED="1365785814748" ID="ID_911344221" MODIFIED="1365805112338" TEXT="benchmark versus Params::Validate">
+<node CREATED="1365805120478" ID="ID_403602084" MODIFIED="1365805135628" TEXT="much faster, even compared to Params::Validate::XS"/>
+</node>
+</node>
+<node CREATED="1365786093068" ID="ID_1062710536" MODIFIED="1365786149491" POSITION="left" TEXT="improve speed for non-inlineable type constraints coercions">
+<node CREATED="1365786151311" ID="ID_213645694" LINK="#ID_962609536" MODIFIED="1365786201307" TEXT="maybe use eval context idea from Type::Check"/>
+</node>
+<node CREATED="1365786289535" ID="ID_460864965" MODIFIED="1365786296483" POSITION="right" TEXT="release 0.001">
+<node CREATED="1365786309321" ID="ID_79331969" MODIFIED="1365786324486" TEXT="Mon 15th April?"/>
+<node CREATED="1365786335877" ID="ID_42424261" MODIFIED="1365786342933" TEXT="publish intro blog article"/>
+</node>
+<node CREATED="1365786461715" ID="ID_1123916121" MODIFIED="1365786480681" POSITION="left" TEXT="Type-Tiny could be used as a backend for Scalar::Does?">
+<node CREATED="1365786482499" ID="ID_957202187" MODIFIED="1365786492545" TEXT="if not, certainly a SEE ALSO"/>
</node>
</node>
</map>
diff --git a/inc/Module/Install/Contributors.pm b/inc/Module/Install/Contributors.pm
deleted file mode 100644
index 95f2571..0000000
--- a/inc/Module/Install/Contributors.pm
+++ /dev/null
@@ -1,24 +0,0 @@
-#line 1
-package Module::Install::Contributors;
-
-use 5.006;
-use strict;
-use warnings;
-
-BEGIN {
- $Module::Install::Contributors::AUTHORITY = 'cpan:TOBYINK';
- $Module::Install::Contributors::VERSION = '0.001';
-}
-
-use base qw(Module::Install::Base);
-
-sub contributors
-{
- my $self = shift;
- push @{ $self->Meta->{values}{x_contributors} ||= [] }, @_;
-}
-
-1;
-
-__END__
-
diff --git a/lib/Test/TypeTiny.pm b/lib/Test/TypeTiny.pm
index bd4452a..c17647c 100644
--- a/lib/Test/TypeTiny.pm
+++ b/lib/Test/TypeTiny.pm
@@ -4,30 +4,45 @@ use Test::More ();
use base "Exporter";
our $AUTHORITY = 'cpan:TOBYINK';
-our $VERSION = '0.000_12';
+our $VERSION = '0.001';
our @EXPORT = qw( should_pass should_fail ok_subtype );
+sub _mk_message
+{
+ require B;
+ my ($template, $value) = @_;
+ sprintf(
+ $template,
+ !defined $value ? 'undef' :
+ !ref $value ? sprintf('value %s', B::perlstring($value)) :
+ do {
+ require Data::Dumper;
+ local $Data::Dumper::Indent = 0;
+ local $Data::Dumper::Useqq = 1;
+ local $Data::Dumper::Terse = 1;
+ local $Data::Dumper::Maxdepth = 2;
+ Data::Dumper::Dumper($value)
+ }
+ );
+}
+
sub should_pass
{
- my ($value, $type) = @_;
+ my ($value, $type, $message) = @_;
@_ = (
!!$type->check($value),
- defined $value
- ? sprintf("value '%s' passes type constraint '%s'", $value, $type)
- : sprintf("undef passes type constraint '%s'", $type),
+ $message || _mk_message("%s passes type constraint $type", $value),
);
goto \&Test::More::ok;
}
sub should_fail
{
- my ($value, $type) = @_;
+ my ($value, $type, $message) = @_;
@_ = (
!$type->check($value),
- defined $value
- ? sprintf("value '%s' fails type constraint '%s'", $value, $type)
- : sprintf("undef fails type constraint '%s'", $type),
+ $message || _mk_message("%s fails type constraint $type", $value),
);
goto \&Test::More::ok;
}
@@ -80,8 +95,12 @@ L<Test::TypeTiny> provides a few handy functions for testing type constraints.
=over
+=item C<< should_pass($value, $type, $test_name) >>
+
=item C<< should_pass($value, $type) >>
+=item C<< should_fail($value, $type, $test_name) >>
+
=item C<< should_fail($value, $type) >>
=item C<< ok_subtype($type, @subtypes) >>
diff --git a/lib/Type/Coercion.pm b/lib/Type/Coercion.pm
index b8c1604..03b3e65 100644
--- a/lib/Type/Coercion.pm
+++ b/lib/Type/Coercion.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Coercion::AUTHORITY = 'cpan:TOBYINK';
- $Type::Coercion::VERSION = '0.000_12';
+ $Type::Coercion::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -453,6 +453,8 @@ L<Type::Tiny::Manual>.
L<Type::Tiny>, L<Type::Library>, L<Type::Utils>, L<Types::Standard>.
+L<Type::Coercion::Union>.
+
L<Moose::Meta::TypeCoercion>.
=head1 AUTHOR
diff --git a/lib/Type/Coercion/Union.pm b/lib/Type/Coercion/Union.pm
index e603bac..e99fafc 100644
--- a/lib/Type/Coercion/Union.pm
+++ b/lib/Type/Coercion/Union.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Coercion::Union::AUTHORITY = 'cpan:TOBYINK';
- $Type::Coercion::Union::VERSION = '0.000_12';
+ $Type::Coercion::Union::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -63,7 +63,7 @@ Type::Coercion::Union - a set of coercions to a union type constraint
This package inherits from L<Type::Coercion>; see that for most documentation.
The major differences are that C<add_type_coercions> always throws an
exception, and the C<type_coercion_map> is automatically populated from
-the child contraints of the union type constraint.
+the child constraints of the union type constraint.
=head1 BUGS
diff --git a/lib/Type/Library.pm b/lib/Type/Library.pm
index 867fd07..401ab4d 100644
--- a/lib/Type/Library.pm
+++ b/lib/Type/Library.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::VERSION = '0.000_12';
+ $Type::Tiny::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -328,15 +328,15 @@ Returns the Type::Tiny object.
=item C<< is_Foo($value) >>
-Returns true iff $value passes the type contraint.
+Returns true iff $value passes the type constraint.
=item C<< assert_Foo($value) >>
-Returns true iff $value passes the type contraint. Dies otherwise.
+Returns true iff $value passes the type constraint. Dies otherwise.
=item C<< to_Foo($value) >>
-Coerces the value to the type. (Not implemented yet.)
+Coerces the value to the type.
=back
diff --git a/lib/Type/Tiny.pm b/lib/Type/Tiny.pm
index 7801fb3..da40905 100644
--- a/lib/Type/Tiny.pm
+++ b/lib/Type/Tiny.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::VERSION = '0.000_12';
+ $Type::Tiny::VERSION = '0.001';
}
use Scalar::Util qw< blessed weaken refaddr isweak >;
@@ -558,11 +558,17 @@ sub _MONKEY_MAGIC
Moose::Meta::TypeConstraint;
my $meta = __PACKAGE__->meta;
$meta->make_mutable;
- $meta->add_attribute(tt_type => (
- reader => "tt_type",
- writer => "_set_tt_type",
- predicate => "has_tt_type"
- ));
+ $meta->add_attribute(
+ "Moose::Meta::Attribute"->new(
+ tt_type => (
+ reader => "tt_type",
+ writer => "_set_tt_type",
+ predicate => "has_tt_type",
+ weak_ref => 1,
+ Class::MOP::_definition_context(),
+ ),
+ ),
+ );
$meta->make_immutable(inline_constructor => 0);
1;
} or _croak("could not perform magic Moose trick: $@");
@@ -639,7 +645,7 @@ Type::Tiny - tiny, yet Moo(se)-compatible type constraint
package Bullwinkle {
use Moose;
- has favourite_number => (is => "ro", isa => $NUM->moose_type);
+ has favourite_number => (is => "ro", isa => $NUM);
}
package Maisy {
@@ -752,6 +758,10 @@ L<Moose::Meta::TypeConstraint> or L<Mouse::Meta::TypeConstraint>.
Generally speaking this attribute should not be passed to the constructor;
you should rely on the default lazily-built objects.
+It should rarely be necessary to obtain a L<Moose::Meta::TypeConstraint>
+object from L<Type::Tiny> because the L<Type::Tiny> object itself should
+be usable pretty much anywhere a L<Moose::Meta::TypeConstraint> is expected.
+
=back
The following additional attributes are used for parameterizable (e.g.
@@ -960,7 +970,7 @@ L<Type::Tiny::Manual>.
L<Type::Library>, L<Type::Utils>, L<Types::Standard>, L<Type::Coercion>.
L<Type::Tiny::Class>, L<Type::Tiny::Role>, L<Type::Tiny::Duck>,
-L<Type::Tiny::Enum>, L<Type::Tiny::Union>.
+L<Type::Tiny::Enum>, L<Type::Tiny::Union>, L<Type::Tiny::Intersection>.
L<Moose::Meta::TypeConstraint>,
L<Mouse::Meta::TypeConstraint>.
diff --git a/lib/Type/Tiny/Class.pm b/lib/Type/Tiny/Class.pm
index 372389e..eea5886 100644
--- a/lib/Type/Tiny/Class.pm
+++ b/lib/Type/Tiny/Class.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::Class::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::Class::VERSION = '0.000_12';
+ $Type::Tiny::Class::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -47,7 +47,7 @@ sub _build_inlined
my $class = $self->class;
sub {
my $var = $_[1];
- qq{blessed($var) and $var->isa(q[$class])};
+ qq{Scalar::Util::blessed($var) and $var->isa(q[$class])};
};
}
diff --git a/lib/Type/Tiny/Duck.pm b/lib/Type/Tiny/Duck.pm
index 9d5a2a6..523d4c8 100644
--- a/lib/Type/Tiny/Duck.pm
+++ b/lib/Type/Tiny/Duck.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::Duck::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::Duck::VERSION = '0.000_12';
+ $Type::Tiny::Duck::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -47,7 +47,7 @@ sub _build_inlined
sub {
my $var = $_[1];
local $" = q{ };
- qq{ blessed($var) and not grep(!$var->can(\$_), qw/@methods/) };
+ qq{ Scalar::Util::blessed($var) and not grep(!$var->can(\$_), qw/@methods/) };
};
}
diff --git a/lib/Type/Tiny/Enum.pm b/lib/Type/Tiny/Enum.pm
index 6818dc2..0ab77ca 100644
--- a/lib/Type/Tiny/Enum.pm
+++ b/lib/Type/Tiny/Enum.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::Enum::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::Enum::VERSION = '0.000_12';
+ $Type::Tiny::Enum::VERSION = '0.001';
}
sub _croak ($;@)
@@ -58,8 +58,8 @@ sub inline_check
my $self = shift;
my $regexp = join "|", map quotemeta, @$self;
$_[0] eq '$_'
- ? "defined and m{^(?:$regexp)\$}"
- : "defined($_[0]) and $_[0] =~ m{^(?:$regexp)\$}";
+ ? "(defined and m{^(?:$regexp)\$})"
+ : "(defined($_[0]) and $_[0] =~ m{^(?:$regexp)\$})";
}
sub _instantiate_moose_type
diff --git a/lib/Type/Tiny/Intersection.pm b/lib/Type/Tiny/Intersection.pm
index 95f44d7..68e0c04 100644
--- a/lib/Type/Tiny/Intersection.pm
+++ b/lib/Type/Tiny/Intersection.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::Intersection::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::Intersection::VERSION = '0.000_12';
+ $Type::Tiny::Intersection::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -64,7 +64,7 @@ sub can_be_inlined
sub inline_check
{
my $self = shift;
- return join " and ", map $_->inline_check($_[0]), @$self;
+ sprintf '(%s)', join " and ", map $_->inline_check($_[0]), @$self;
}
1;
diff --git a/lib/Type/Tiny/Manual.pod b/lib/Type/Tiny/Manual.pod
index ab90654..8b40d68 100644
--- a/lib/Type/Tiny/Manual.pod
+++ b/lib/Type/Tiny/Manual.pod
@@ -8,7 +8,7 @@ Type::Tiny::Manual - an overview of Type::Tiny
=head1 SYNOPSIS
-Type::Tiny is a small framework for writing type constraints and organising
+Type::Tiny is a small framework for writing type constraints and organizing
them into type libraries. Although inspired by Moose's type constraint API,
it has no non-core dependencies, and can be used with L<Moose>, L<Mouse> and
L<Moo>.
diff --git a/lib/Type/Tiny/Role.pm b/lib/Type/Tiny/Role.pm
index 7eea35b..842a2fd 100644
--- a/lib/Type/Tiny/Role.pm
+++ b/lib/Type/Tiny/Role.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::Role::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::Role::VERSION = '0.000_12';
+ $Type::Tiny::Role::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -45,7 +45,7 @@ sub _build_inlined
my $role = $self->role;
sub {
my $var = $_[1];
- qq{blessed($var) and do { my \$method = $var->can('DOES')||$var->can('isa'); $var->\$method(q[$role]) }};
+ qq{Scalar::Util::blessed($var) and do { my \$method = $var->can('DOES')||$var->can('isa'); $var->\$method(q[$role]) }};
};
}
diff --git a/lib/Type/Tiny/Union.pm b/lib/Type/Tiny/Union.pm
index b08aa21..d4bcf39 100644
--- a/lib/Type/Tiny/Union.pm
+++ b/lib/Type/Tiny/Union.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Tiny::Union::AUTHORITY = 'cpan:TOBYINK';
- $Type::Tiny::Union::VERSION = '0.000_12';
+ $Type::Tiny::Union::VERSION = '0.001';
}
use Scalar::Util qw< blessed >;
@@ -73,7 +73,7 @@ sub can_be_inlined
sub inline_check
{
my $self = shift;
- join " or ", map $_->inline_check($_[0]), @$self;
+ sprintf '(%s)', join " or ", map $_->inline_check($_[0]), @$self;
}
sub _instantiate_moose_type
diff --git a/lib/Type/Utils.pm b/lib/Type/Utils.pm
index 51fcd5d..f697ac9 100644
--- a/lib/Type/Utils.pm
+++ b/lib/Type/Utils.pm
@@ -6,7 +6,7 @@ use warnings;
BEGIN {
$Type::Utils::AUTHORITY = 'cpan:TOBYINK';
- $Type::Utils::VERSION = '0.000_12';
+ $Type::Utils::VERSION = '0.001';
}
sub _croak ($;@) {
diff --git a/lib/Types/Standard.pm b/lib/Types/Standard.pm
index ebe1628..b5ebf73 100644
--- a/lib/Types/Standard.pm
+++ b/lib/Types/Standard.pm
@@ -5,15 +5,15 @@ use warnings;
BEGIN {
$Types::Standard::AUTHORITY = 'cpan:TOBYINK';
- $Types::Standard::VERSION = '0.000_12';
+ $Types::Standard::VERSION = '0.001';
}
use base "Type::Library";
-use Type::Utils;
-
our @EXPORT_OK = qw( slurpy );
use Scalar::Util qw( blessed looks_like_number );
+use Type::Utils;
+use Types::TypeTiny ();
sub _is_class_loaded {
return !!0 if ref $_[0];
@@ -27,6 +27,15 @@ sub _is_class_loaded {
return !!0;
}
+sub _croak ($;@)
+{
+ require Carp;
+ @_ = sprintf($_[0], @_[1..$#_]) if @_ > 1;
+ goto \&Carp::croak;
+}
+
+no warnings;
+
declare "Any",
_is_core => 1,
inline_as { "!!1" };
@@ -97,6 +106,10 @@ declare "Ref",
constraint_generator => sub
{
my $reftype = shift;
+ Types::TypeTiny::StringLike->check($reftype)
+ or _croak("Parameter to Ref[`a] expected to be string; got $reftype");
+
+ $reftype = "$reftype";
return sub {
ref($_[0]) and Scalar::Util::reftype($_[0]) eq $reftype;
}
@@ -147,7 +160,10 @@ declare "ArrayRef",
inline_as { "ref($_) eq 'ARRAY'" },
constraint_generator => sub
{
- my $param = shift;
+ my $param = Types::TypeTiny::to_TypeTiny(shift);
+ Types::TypeTiny::TypeTiny->check($param)
+ or _croak("Parameter to ArrayRef[`a] expected to be a type constraint; got $param");
+
return sub
{
my $array = shift;
@@ -178,7 +194,10 @@ declare "HashRef",
inline_as { "ref($_) eq 'HASH'" },
constraint_generator => sub
{
- my $param = shift;
+ my $param = Types::TypeTiny::to_TypeTiny(shift);
+ Types::TypeTiny::TypeTiny->check($param)
+ or _croak("Parameter to HashRef[`a] expected to be a type constraint; got $param");
+
return sub
{
my $hash = shift;
@@ -209,7 +228,10 @@ declare "ScalarRef",
inline_as { "ref($_) eq 'SCALAR' or ref($_) eq 'REF'" },
constraint_generator => sub
{
- my $param = shift;
+ my $param = Types::TypeTiny::to_TypeTiny(shift);
+ Types::TypeTiny::TypeTiny->check($param)
+ or _croak("Parameter to ScalarRef[`a] expected to be a type constraint; got $param");
+
return sub
{
my $ref = shift;
@@ -238,7 +260,10 @@ declare "Maybe",
as "Item",
constraint_generator => sub
{
- my $param = shift;
+ my $param = Types::TypeTiny::to_TypeTiny(shift);
+ Types::TypeTiny::TypeTiny->check($param)
+ or _croak("Parameter to Maybe[`a] expected to be a type constraint; got $param");
+
return sub
{
my $value = shift;
@@ -262,7 +287,12 @@ declare "Map",
inline_as { "ref($_) eq 'HASH'" },
constraint_generator => sub
{
- my ($keys, $values) = @_;
+ my ($keys, $values) = map Types::TypeTiny::to_TypeTiny($_), @_;
+ Types::TypeTiny::TypeTiny->check($keys)
+ or _croak("First parameter to Map[`k,`v] expected to be a type constraint; got $keys");
+ Types::TypeTiny::TypeTiny->check($values)
+ or _croak("Second parameter to Map[`k,`v] expected to be a type constraint; got $values");
+
return sub
{
my $hash = shift;
@@ -295,7 +325,10 @@ declare "Optional",
as "Item",
constraint_generator => sub
{
- my $param = shift;
+ my $param = Types::TypeTiny::to_TypeTiny(shift);
+ Types::TypeTiny::TypeTiny->check($param)
+ or _croak("Parameter to Optional[`a] expected to be a type constraint; got $param");
+
sub { exists($_[0]) ? $param->check($_[0]) : !!1 }
},
inline_generator => sub {
@@ -325,9 +358,18 @@ declare "Tuple",
my $slurpy;
if (exists $constraints[-1] and ref $constraints[-1] eq "HASH")
{
- $slurpy = pop(@constraints)->{slurpy};
+ $slurpy = Types::TypeTiny::to_TypeTiny(pop(@constraints)->{slurpy});
+ Types::TypeTiny::TypeTiny->check($slurpy)
+ or _croak("Slurpy parameter to Tuple[...] expected to be a type constraint; got $slurpy");
}
-
+
+ @constraints = map Types::TypeTiny::to_TypeTiny($_), @constraints;
+ for (@constraints)
+ {
+ Types::TypeTiny::TypeTiny->check($_)
+ or _croak("Parameters to Tuple[...] expected to be type constraints; got $_");
+ }
+
return sub
{
my $value = $_[0];
@@ -380,6 +422,14 @@ declare "Dict",
constraint_generator => sub
{
my %constraints = @_;
+
+ while (my ($k, $v) = each %constraints)
+ {
+ $constraints{$k} = Types::TypeTiny::to_TypeTiny($v);
+ Types::TypeTiny::TypeTiny->check($v)
+ or _croak("Parameter to Dict[`a] for key '$k' expected to be a type constraint; got $v");
+ }
+
return sub
{
my $value = $_[0];
@@ -421,7 +471,12 @@ declare "Overload",
inline_as { "Scalar::Util::blessed($_) and overload::Overloaded($_)" },
constraint_generator => sub
{
- my @operations = @_;
+ my @operations = map {
+ Type::Tiny::StringLike->check($_)
+ ? "$_"
+ : _croak("Parameters to Overload[`a] expected to be a strings; got $_");
+ } @_;
+
return sub {
my $value = shift;
for my $op (@operations) {
@@ -445,6 +500,17 @@ declare "StrMatch",
constraint_generator => sub
{
my ($regexp, $checker) = @_;
+
+ ref($regexp) eq 'Regexp'
+ or _croak("First parameter to StrMatch[`a] expected to be a Regexp; got $regexp");
+
+ if (@_ > 1)
+ {
+ $checker = Type::Tiny::to_TypeTiny($checker);
+ Type::Tiny::TypeTiny->check($checker)
+ or _croak("Second parameter to StrMatch[`a] expected to be a type constraint; got $checker")
+ }
+
$checker
? sub {
my $value = shift;
diff --git a/lib/Types/TypeTiny.pm b/lib/Types/TypeTiny.pm
index e664150..365bbe0 100644
--- a/lib/Types/TypeTiny.pm
+++ b/lib/Types/TypeTiny.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
our $AUTHORITY = 'cpan:TOBYINK';
-our $VERSION = '0.000_12';
+our $VERSION = '0.001';
use Scalar::Util qw< blessed >;
diff --git a/meta/changes.pret b/meta/changes.pret
index 7ceb1ed..95b1030 100644
--- a/meta/changes.pret
+++ b/meta/changes.pret
@@ -108,7 +108,7 @@
issued 2013-04-11;
changeset [
item "Fix prototype for Type::Utils::as."^^Bugfix;
- item "BIG, AWESOME CHANGE: no longer need to pass '-moose' parameter when importing a library into a Moose class; only Mouse needs that treatment now."^^Change;
+ item "No longer need to pass '-moose' parameter when importing a library into a Moose class; only Mouse needs that treatment now."^^Change;
].
`Type-Tiny 0.000_12 cpan:TOBYINK`
@@ -116,3 +116,16 @@
changeset [
item "Fix minor typo."^^Documentation;
].
+
+`Type-Tiny 0.001 cpan:TOBYINK`
+ issued 2013-04-15;
+ label "First public release";
+ changeset [
+ item "Minor improvements."^^Documentation;
+ item "Some inline code assumed that it would be compiled in a package that had 'blessed' imported."^^Bugfix;
+ item "Some inline code wasn't wrapped in parentheses."^^Bugfix;
+ item "More test cases for Optional[`a] within Dict[`a]."^^Addition;
+ item "Weaken the reference from a Moose::Meta::TypeConstraint object to its Type::Tiny origin."^^Change;
+ item "Parameterized type constraints in Types::Standard now do some sanity checking on their arguments."^^Change;
+ item "Improve test names generated by Test::TypeTiny; allow test scripts to provide test names."^^Change;
+ ].
diff --git a/meta/doap.pret b/meta/doap.pret
index 8c02de2..eb7924e 100644
--- a/meta/doap.pret
+++ b/meta/doap.pret
@@ -12,7 +12,16 @@
:created 2013-03-23;
:license <http://dev.perl.org/licenses/>;
:maintainer cpan:TOBYINK;
- :developer cpan:TOBYINK.
+ :developer cpan:TOBYINK;
+ :category
+ [ label "Moo" ],
+ [ label "Moose" ],
+ [ label "Mouse" ],
+ [ label "Type Constraint" ],
+ [ label "Type Coercion" ],
+ [ label "Type Library" ],
+ [ label "Schema" ],
+ [ label "Validation" ].
<http://dev.perl.org/licenses/>
dc:title "the same terms as the perl 5 programming language system itself".
diff --git a/meta/people.pret b/meta/people.pret
index c5842a6..55745c9 100644
--- a/meta/people.pret
+++ b/meta/people.pret
@@ -6,5 +6,21 @@ cpan:TOBYINK
:name "Toby Inkster";
:mbox <mailto:tobyink at cpan.org>.
+# This dude gets a thanks...
+
cpan:MSTROUT
- :name "Matt S Trout".
\ No newline at end of file
+ :name "Matt S Trout".
+
+# We bundle some files made by these dudes...
+
+cpan:RJBS
+ :name "Ricardo Signes".
+
+cpan:TOKUHIROM
+ :name "MATSUNO Tokuhiro".
+
+cpan:NUFFIN
+ :name "Yuval Kogman".
+
+cpan:INGY
+ :name "Ingy döt Net".
diff --git a/meta/rights.pret b/meta/rights.pret
new file mode 100644
index 0000000..499f748
--- /dev/null
+++ b/meta/rights.pret
@@ -0,0 +1,75 @@
+f`CONTRIBUTING`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`CREDITS`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`Changes`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`LICENSE`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`META.ttl`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`Makefile.PL`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`NEWS`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`README`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`TODO`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`TODO.mm`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`meta/changes.pret`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`meta/doap.pret`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`meta/makefile.pret`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`meta/people.pret`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`meta/rights.pret`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOBYINK.
+
+f`inc/Test/Fatal.pm`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:RJBS.
+
+f`inc/Test/Requires.pm`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:TOKUHIROM.
+
+f`inc/Try/Tiny.pm`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:NUFFIN.
+
+f`MANIFEST.SKIP`
+ dc:license <http://dev.perl.org/licenses/>;
+ dc:rightsHolder cpan:INGY.
diff --git a/t/stdlib-structures.t b/t/stdlib-structures.t
index 513d539..a904a43 100644
--- a/t/stdlib-structures.t
+++ b/t/stdlib-structures.t
@@ -75,6 +75,8 @@ should_fail({ name => "Bob", age => 40.1 }, $struct4);
should_fail({ name => "Bob", age => 40, weight => 80.3 }, $struct4);
should_fail({ name => "Bob", age => 40, height => 1.76, weight => 80.3 }, $struct4);
should_fail({ name => "Bob", age => 40, height => "xyz" }, $struct4);
+should_fail({ name => "Bob", age => 40, height => undef }, $struct4);
+should_fail({ name => "Bob", age => undef, height => 1.76 }, $struct4);
my $opt1 = Optional[Int];
ok( $opt1->check(), "$opt1 check ()");
diff --git a/t/stdlib.t b/t/stdlib.t
index 546dbc7..2bdc6ac 100644
--- a/t/stdlib.t
+++ b/t/stdlib.t
@@ -24,6 +24,7 @@ use warnings;
use lib qw( . ./t ../inc ./inc );
use Test::More;
+use Test::Fatal;
use Test::TypeTiny;
use Types::Standard -all;
@@ -99,6 +100,13 @@ should_fail([[]], ArrayRef[Int]);
should_pass([[3]], ArrayRef[ArrayRef[Int]]);
should_fail([["A"]], ArrayRef[ArrayRef[Int]]);
+my $deep = ArrayRef[HashRef[ArrayRef[HashRef[Int]]]];
+ok($deep->can_be_inlined, "$deep can be inlined");
+
+should_pass([{foo1=>[{bar=>1}]},{foo2=>[{baz=>2}]}], $deep);
+should_pass([{foo1=>[{bar=>1}]},{foo2=>[]}], $deep);
+should_fail([{foo1=>[{bar=>1}]},{foo2=>[2]}], $deep);
+
should_pass(undef, Maybe[Int]);
should_pass(123, Maybe[Int]);
should_fail(1.3, Maybe[Int]);
@@ -125,4 +133,28 @@ should_fail(bless({}, "Local::Class4"), Ref["ARRAY"]);
should_fail([], Ref["HASH"]);
should_fail({}, Ref["ARRAY"]);
+like(
+ exception { ArrayRef["Int"] },
+ qr{^Parameter to ArrayRef\[\`a\] expected to be a type constraint; got Int},
+ qq{ArrayRef["Int"] is not a valid type constraint},
+);
+
+like(
+ exception { HashRef[[]] },
+ qr{^Parameter to HashRef\[\`a\] expected to be a type constraint; got ARRAY},
+ qq{HashRef[[]] is not a valid type constraint},
+);
+
+like(
+ exception { ScalarRef[undef] },
+ qr{^Parameter to ScalarRef\[\`a\] expected to be a type constraint; got},
+ qq{ScalarRef[undef] is not a valid type constraint},
+);
+
+like(
+ exception { Ref[{}] },
+ qr{^Parameter to Ref\[\`a\] expected to be string; got HASH},
+ qq{Ref[{}] is not a valid type constraint},
+);
+
done_testing;
--
libtype-tiny-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list