[SCM] libtype-tiny-perl Debian packaging branch, master, updated. debian/0.001-1-4-g78e771b
Jonas Smedegaard
dr at jones.dk
Sun Apr 28 16:55:53 UTC 2013
The following commit has been merged in the master branch:
commit 9bd4dfcba2c5bee29497b7fd0c9efa987f5dd174
Author: Jonas Smedegaard <dr at jones.dk>
Date: Sun Apr 28 18:34:57 2013 +0200
Imported Upstream version 0.002
diff --git a/COPYRIGHT b/COPYRIGHT
index 1da800c..865dc92 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -31,6 +31,7 @@ Files: examples/benchmark-coercions.pl
t/coercion-modifiers.t
t/coercion-union.t
t/coercion.t
+ t/exporter-roleconflict.t
t/lib/BiggerLib.pm
t/lib/DemoLib.pm
t/library-assert.t
@@ -45,8 +46,10 @@ Files: examples/benchmark-coercions.pl
t/moose.t
t/mouse-coercion.t
t/mouse.t
+ t/parameterization.t
t/stdlib-inlined.t
t/stdlib-overload.t
+ t/stdlib-str.t
t/stdlib-strmatch.t
t/stdlib-structures.t
t/stdlib.t
diff --git a/CREDITS b/CREDITS
index 2d8ec26..086b54b 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3,4 +3,5 @@ Maintainer:
Thanks:
- Matt S Trout (cpan:MSTROUT) <MSTROUT at cpan.org>
+- Kevin Dawson (cpan:BOWTIE) <BOWTIE at cpan.org>
diff --git a/Changes b/Changes
index c9bdc80..e5ee1cd 100644
--- a/Changes
+++ b/Changes
@@ -6,6 +6,18 @@ 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.002 2013-04-26
+
+ - (Addition) Chars and Bytes types added to Types::Standard.
+ - (Bugfix) Fix method conflicts when exporting type constraints to roles.
+ ++$BOWTIE
+ - (Bugfix) Prevent warnings (about 'my $val' masking a previously declared
+ variable) when several Str checks are being inlined in close proximity,
+ such as Tuple[Str,Str]
+ - (Documentation) Link from Test::TypeTiny to Test::Deep::Type.
+ - Avoid unnecessarily regenerating parameterized type constraints.
+ - Make Type::Tiny's has_coercion method more DWIM.
+
0.001 2013-04-15 # First public release
- (Addition) More test cases for Optional[`a] within Dict[`a].
diff --git a/MANIFEST b/MANIFEST
index f7cfb6a..4516304 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -62,6 +62,7 @@ t/coercion-inlining.t
t/coercion-modifiers.t
t/coercion-union.t
t/coercion.t
+t/exporter-roleconflict.t
t/lib/BiggerLib.pm
t/lib/DemoLib.pm
t/library-assert.t
@@ -76,8 +77,10 @@ t/moose-coercion.t
t/moose.t
t/mouse-coercion.t
t/mouse.t
+t/parameterization.t
t/stdlib-inlined.t
t/stdlib-overload.t
+t/stdlib-str.t
t/stdlib-strmatch.t
t/stdlib-structures.t
t/stdlib.t
diff --git a/META.ttl b/META.ttl
index d60d6ac..03b6be1 100644
--- a/META.ttl
+++ b/META.ttl
@@ -1,5 +1,6 @@
@prefix cpan: <http://purl.org/NET/cpan-uri/person/> .
@prefix cpant: <http://purl.org/NET/cpan-uri/terms#> .
+ at prefix dbug: <http://ontologi.es/doap-bugs#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dcs: <http://ontologi.es/doap-changeset#> .
@prefix dist: <http://purl.org/NET/cpan-uri/dist/Type-Tiny/> .
@@ -64,6 +65,7 @@ dist:project
doap:release dist:v_0-000_11;
doap:release dist:v_0-000_12;
doap:release dist:v_0-001;
+ doap:release dist:v_0-002;
doap:repository [
a doap:HgRepository;
doap:browse <https://bitbucket.org/tobyink/p5-type-tiny>;
@@ -106,6 +108,7 @@ dist:v_0-000_02
a dcs:Addition;
rdfs:label "use Type::Library -declare";
];
+ dcs:versus dist:v_0-000_01;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_02.tar.gz>;
@@ -145,6 +148,7 @@ dist:v_0-000_03
a dcs:Bugfix;
rdfs:label "Fix the crashing t/moo-inflation.t test case.";
];
+ dcs:versus dist:v_0-000_02;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_03.tar.gz>;
@@ -176,6 +180,7 @@ dist:v_0-000_04
a dcs:Change;
rdfs:label "Allow coercion code to be expressed as a string; quite a bit faster.";
];
+ dcs:versus dist:v_0-000_03;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_04.tar.gz>;
@@ -223,6 +228,7 @@ dist:v_0-000_05
a dcs:Bugfix;
rdfs:label "Get Mouse coercions working.";
];
+ dcs:versus dist:v_0-000_04;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_05.tar.gz>;
@@ -272,6 +278,7 @@ dist:v_0-000_06
rdfs:label "In Moo, type assertions and coercions are now inlined.";
dcs:thanks cpan:mstrout;
];
+ dcs:versus dist:v_0-000_05;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_06.tar.gz>;
@@ -304,6 +311,7 @@ dist:v_0-000_07
a dcs:Bugfix;
rdfs:label "Fix inlining of certain conditionals into coercion code.";
];
+ dcs:versus dist:v_0-000_06;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_07.tar.gz>;
@@ -327,6 +335,7 @@ dist:v_0-000_08
a dcs:Addition;
rdfs:label "Types::TypeTiny::to_TypeTiny can be used to coerce a Moose type constraint object to Type::Tiny.";
];
+ dcs:versus dist:v_0-000_07;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_08.tar.gz>;
@@ -354,6 +363,7 @@ dist:v_0-000_09
a dcs:Documentation;
rdfs:label "Fill in the Usage with Moose section of the fine manual.";
];
+ dcs:versus dist:v_0-000_08;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_09.tar.gz>;
@@ -373,6 +383,7 @@ dist:v_0-000_10
a dcs:Bugfix;
rdfs:label "Fix incorrect Test::Requires line in 'mouse-coercion.t'.";
];
+ dcs:versus dist:v_0-000_09;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_10.tar.gz>;
@@ -392,6 +403,7 @@ dist:v_0-000_11
a dcs:Change;
rdfs:label "No longer need to pass '-moose' parameter when importing a library into a Moose class; only Mouse needs that treatment now.";
];
+ dcs:versus dist:v_0-000_10;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_11.tar.gz>;
@@ -407,6 +419,7 @@ dist:v_0-000_12
a dcs:Documentation;
rdfs:label "Fix minor typo.";
];
+ dcs:versus dist:v_0-000_11;
];
dcs:released-by cpan:tobyink;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.000_12.tar.gz>;
@@ -446,11 +459,55 @@ dist:v_0-001
a dcs:Change;
rdfs:label "Improve test names generated by Test::TypeTiny; allow test scripts to provide test names.";
];
+ dcs:versus dist:v_0-000_12;
];
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.
+dist:v_0-002
+ a doap:Version;
+ dc:identifier "Type-Tiny-0.002"^^xsd:string;
+ dc:issued "2013-04-26"^^xsd:date;
+ dcs:changeset [
+ dcs:item [
+ a dcs:Documentation;
+ rdfs:label "Link from Test::TypeTiny to Test::Deep::Type.";
+ ];
+ dcs:item [
+ a dcs:Change;
+ rdfs:label "Avoid unnecessarily regenerating parameterized type constraints.";
+ ];
+ dcs:item [
+ a dcs:Change;
+ rdfs:label "Make Type::Tiny's has_coercion method more DWIM.";
+ ];
+ dcs:item [
+ a dcs:Addition;
+ rdfs:label "Chars and Bytes types added to Types::Standard.";
+ ];
+ dcs:item [
+ a dcs:Bugfix;
+ rdfs:label "Prevent warnings (about 'my $val' masking a previously declared variable) when several Str checks are being inlined in close proximity, such as Tuple[Str,Str]";
+ ];
+ dcs:item [
+ a dcs:Bugfix;
+ rdfs:label "Fix method conflicts when exporting type constraints to roles.";
+ dcs:fixes [ dbug:reporter cpan:bowtie ];
+ dcs:thanks cpan:bowtie;
+ ];
+ dcs:versus dist:v_0-001;
+ ];
+ dcs:released-by cpan:tobyink;
+ doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.002.tar.gz>;
+ doap:revision "0.002"^^xsd:string.
+
+cpan:bowtie
+ a foaf:Person;
+ foaf:name "Kevin Dawson";
+ foaf:nick "BOWTIE";
+ foaf:page <https://metacpan.org/author/BOWTIE>.
+
cpan:ingy
a foaf:Person;
foaf:name "Ingy d\u00F6t Net";
diff --git a/META.yml b/META.yml
index ca403c4..502748e 100644
--- a/META.yml
+++ b/META.yml
@@ -38,4 +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.001
+version: 0.002
diff --git a/README b/README
index 648a14a..2e418eb 100644
--- a/README
+++ b/README
@@ -139,10 +139,14 @@ DESCRIPTION
parameters.
Methods
- "has_parent", "has_coercion", "has_library", "has_constraint_generator",
- "has_inlined", "has_inline_generator", "has_parameters"
+ "has_parent", "has_library", "has_constraint_generator", "has_inlined",
+ "has_inline_generator", "has_parameters"
Predicate methods.
+ "has_coercion"
+ Predicate method with a little extra DWIM. Returns false if the
+ coercion is a no-op.
+
"is_anon"
Returns true iff the type constraint does not have a "name".
diff --git a/SIGNATURE b/SIGNATURE
index e5d2263..17b0766 100644
--- a/SIGNATURE
+++ b/SIGNATURE
@@ -15,16 +15,16 @@ not run its Makefile.PL or Build.PL.
Hash: SHA1
SHA1 f983c18fdb491c4b733235d54e8ca7563b67a6a3 CONTRIBUTING
-SHA1 30c00b56ebc663a9b2461edfd5962a386533f2dd COPYRIGHT
-SHA1 85619fd047875e0f73e145ce3dd257466152282f CREDITS
-SHA1 6f026f93099b70c9df0b416b9d3b3b4894de676b Changes
+SHA1 9217b66d6c696fa6d69b05b173389330e8f278a0 COPYRIGHT
+SHA1 3b19c73e0a3d222e3aed9170d6c219270decdfaf CREDITS
+SHA1 672e242cdb90866e43e72692f0bdc843d81e3cc9 Changes
SHA1 937d452c5c4069f4cda9ffaf45a33f1eb5f060e8 LICENSE
-SHA1 c89aca6b6b31eec52f11dfae2343a4451817e550 MANIFEST
-SHA1 1c481cee3e7321842ceaa4d3f01b6641bc907807 META.ttl
-SHA1 f9c5d0c4f612a9d68a8f2690a2cd7cefc9e6c866 META.yml
+SHA1 e333dd6be0fee9b1abd1f6831609298aa169a5e4 MANIFEST
+SHA1 1bc4a2a6187a43a93a548bd4f9752db915de0303 META.ttl
+SHA1 798009c5c91b6b471f1833aca0e1dd3889b8be4f META.yml
SHA1 e1bc19b712df138f9088b140d73a5372e0c3ba12 Makefile.PL
SHA1 972e88dc55325cd2c1bb25f1c52b7cff3abfb622 NEWS
-SHA1 455ab9ddcd888f7692fb118d6f4cbd626ca6df06 README
+SHA1 4ce6fb319a4b1bbf100d604628a5eb8c92b0c439 README
SHA1 e9bbdc9af497daa21deef5bf605609feb1864349 TODO
SHA1 f857afbe459d89cb5a7b643d01e949938e64c78a TODO.mm
SHA1 88ed92a833b81d179b9fcda10d179915c4434c0f examples/benchmark-coercions.pl
@@ -50,29 +50,29 @@ 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 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 dbeac22fe812ab5ffa30aad30cdf0bfa83d8c414 lib/Test/TypeTiny.pm
+SHA1 e78da7fec063bced38394d45ce246f92ace3d20a lib/Type/Coercion.pm
+SHA1 bba12c4bcfbfd9ab45b51c815a7e68ebd00c6bb7 lib/Type/Coercion/Union.pm
+SHA1 4394f653aa5ff0210e44dd76d621714747e7f544 lib/Type/Library.pm
+SHA1 12fd4a0ace7098ce4f4a5baf607069d842369ddb lib/Type/Tiny.pm
+SHA1 9849916bf75a190f5712147866523fe53ff012be lib/Type/Tiny/Class.pm
+SHA1 2362392975bcc1e7ff973fda8647a4c3b8b9d1b7 lib/Type/Tiny/Duck.pm
+SHA1 edda8330df76941f0e632a0734ee8ba030bd86ae lib/Type/Tiny/Enum.pm
+SHA1 1b2d4713fb72f46e463c1da113f3ae9e73ab74fa lib/Type/Tiny/Intersection.pm
+SHA1 b9fda86fd1777588fc3f35b34ec3cf45bea6ba0c 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 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 5a37fc9d5deab6bd77d815707b81853f8614188f lib/Type/Tiny/Role.pm
+SHA1 8e161d83ad178b5a6a48371bad843bcdb33d0d51 lib/Type/Tiny/Union.pm
+SHA1 122a96f19300b80026a68c490b2aac9198abf61b lib/Type/Utils.pm
+SHA1 4e22091800d9d1dffe9db2a93a49de9e426a879b lib/Types/Standard.pm
+SHA1 85f767b9267c408447267c775b11296b232d4164 lib/Types/TypeTiny.pm
+SHA1 091badcba0935fa10bec14deefe2e57bfcab0635 meta/changes.pret
SHA1 96293c2090ea5735bf0f2d91a0e25e6209688ccb meta/doap.pret
SHA1 49944647c1c4695a769cb5bdc577f8e63ec8857e meta/makefile.pret
-SHA1 371e07cf06bca3fd64ac02786319827cc30d6e87 meta/people.pret
+SHA1 eb38f853388da5e0f147e0834b0d9790e651c027 meta/people.pret
SHA1 6ba0a6e51c478a41b16e1ab4a615e10b776e7ac2 meta/rights.pret
SHA1 da8bcd7d82bd7b49ae48ae36c909be6235817107 t/00-compile.t
SHA1 96a85724daff6e8f04b7194d05e4ab751c13c856 t/arithmetic.t
@@ -80,6 +80,7 @@ SHA1 1ef0933cd3d2a51f580bef90a1f21119842b0a29 t/coercion-inlining.t
SHA1 e009266d6abb401d4ebd853d1812e4f29bfb5bb5 t/coercion-modifiers.t
SHA1 6a6f29d9b738a422371a3245f1f7332a4ec7c81f t/coercion-union.t
SHA1 11feb93d353b464413364c0cfed675b3529fc43a t/coercion.t
+SHA1 16828a2d1da3bd05a941cfef3da6befc8287d938 t/exporter-roleconflict.t
SHA1 7779ff8994ff2fc08e4addd50de265a97f38c70f t/lib/BiggerLib.pm
SHA1 a2396d638af3b1374b9dee7a4a34c385f859ff3c t/lib/DemoLib.pm
SHA1 295e3f8e6205a3f584ffb4a8826167f86286bf42 t/library-assert.t
@@ -94,8 +95,10 @@ SHA1 cea80a416f24a01aaddb7337ec096657878fff23 t/moose-coercion.t
SHA1 1b0625cd0a137db09ac8bb0be6659e87679168ba t/moose.t
SHA1 50f33ec1e4ebff38b3430f8475b36f1ec542fba0 t/mouse-coercion.t
SHA1 996a6aabfe5375df3f4e3212ce424f0b55f5b500 t/mouse.t
+SHA1 89eec5c83cdf12fb16f3f4a6f7e844b0ab58e924 t/parameterization.t
SHA1 d09b552564513962858c918f6ad25f43d5a471b7 t/stdlib-inlined.t
SHA1 e7ddd8cad949dc66b248a213c5c04c49477c1eaa t/stdlib-overload.t
+SHA1 a4093503d4cb2b0a98617bc4cb5d67e4b62e0664 t/stdlib-str.t
SHA1 15eea5a85a26a2dc3d508198ef39dff6d7d4efb4 t/stdlib-strmatch.t
SHA1 9022de0b06c66d134043829ca4d5f56395f814f7 t/stdlib-structures.t
SHA1 b08538ebc5340af9ba079c21bed4db8f882c80b4 t/stdlib.t
@@ -110,7 +113,7 @@ SHA1 6522a316330488fdc29bbc5ede8f381a00276c62 t/type.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
-iEYEARECAAYFAlFr9VoACgkQzr+BKGoqfTnx+QCfZ1fGa7scAdh8oVpP+rTJeEWW
-mgwAn2gRpL9k+D5B13bQ2wEPNllUVozK
-=QeEd
+iEYEARECAAYFAlF6JAIACgkQzr+BKGoqfTkg7gCgtybPQTGA4RjvbYSgE+b8vJ8h
+SREAn1I/Dzkb7Lo9l4qFatL+o7td/cCA
+=KXox
-----END PGP SIGNATURE-----
diff --git a/lib/Test/TypeTiny.pm b/lib/Test/TypeTiny.pm
index c17647c..f9ce50b 100644
--- a/lib/Test/TypeTiny.pm
+++ b/lib/Test/TypeTiny.pm
@@ -4,7 +4,7 @@ use Test::More ();
use base "Exporter";
our $AUTHORITY = 'cpan:TOBYINK';
-our $VERSION = '0.001';
+our $VERSION = '0.002';
our @EXPORT = qw( should_pass should_fail ok_subtype );
@@ -116,6 +116,9 @@ L<http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
L<Type::Tiny>.
+For an alternative to C<should_pass>, see L<Test::Deep::Type> which will
+happily accept a Type::Tiny type constraint instead of a MooseX::Types one.
+
=head1 AUTHOR
Toby Inkster E<lt>tobyink at cpan.orgE<gt>.
diff --git a/lib/Type/Coercion.pm b/lib/Type/Coercion.pm
index 03b3e65..8a0e94e 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.001';
+ $Type::Coercion::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Coercion/Union.pm b/lib/Type/Coercion/Union.pm
index e99fafc..17935eb 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.001';
+ $Type::Coercion::Union::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Library.pm b/lib/Type/Library.pm
index 401ab4d..5dfc16e 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.001';
+ $Type::Tiny::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
@@ -136,12 +136,7 @@ sub _export
elsif ($type = $meta->get_type($sub->{sub}))
{
- $export_coderef = _subname $type->qualified_name, sub (;@)
- {
- my $params; $params = shift if ref($_[0]) eq "ARRAY";
- my $t = $params ? $type->parameterize(@$params) : $type;
- @_ && wantarray ? return($t, @_) : return $t;
- }
+ $export_coderef = ref($meta)->can($sub->{sub});
}
elsif (scalar grep($_ eq $sub->{sub}, $class->_EXPORT_OK) and my $additional = $class->can($sub->{sub}))
diff --git a/lib/Type/Tiny.pm b/lib/Type/Tiny.pm
index da40905..a8d74e2 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.001';
+ $Type::Tiny::VERSION = '0.002';
}
use Scalar::Util qw< blessed weaken refaddr isweak >;
@@ -113,7 +113,7 @@ sub mouse_type { $_[0]{mouse_type} ||= $_[0]->_build_mouse_typ
sub has_parent { exists $_[0]{parent} }
sub has_library { exists $_[0]{library} }
-sub has_coercion { exists $_[0]{coercion} }
+sub has_coercion { exists $_[0]{coercion} and !!@{ $_[0]{coercion}->type_coercion_map } }
sub has_inlined { exists $_[0]{inlined} }
sub has_constraint_generator { exists $_[0]{constraint_generator} }
sub has_inline_generator { exists $_[0]{inline_generator} }
@@ -380,6 +380,7 @@ sub is_parameterized
shift->has_parameters;
}
+my %param_cache;
sub parameterize
{
my $self = shift;
@@ -389,6 +390,17 @@ sub parameterize
@_ = map to_TypeTiny($_), @_;
+ # Generate a key for caching parameterized type constraints,
+ # but only if all the parameters are strings or type constraints.
+ my $key;
+ unless (grep(ref($_) && !TypeTiny->check($_), @_))
+ {
+ require B;
+ $key = join ":", map(TypeTiny->check($_) ? $_->{uniq} : B::perlstring($_), $self, @_);
+ }
+
+ return $param_cache{$key} if defined $key && defined $param_cache{$key};
+
local $_ = $_[0];
my %options = (
constraint => $self->constraint_generator->(@_),
@@ -399,7 +411,15 @@ sub parameterize
if $self->has_inline_generator;
delete $options{inlined} unless defined $options{inlined};
- return $self->create_child_type(%options);
+ my $P = $self->create_child_type(%options);
+
+ if (defined $key)
+ {
+ $param_cache{$key} = $P;
+ weaken($param_cache{$key});
+ }
+
+ return $P;
}
sub child_type_class
@@ -795,10 +815,15 @@ A coderef which generates a new inlining coderef based on parameters.
=over
-=item C<has_parent>, C<has_coercion>, C<has_library>, C<has_constraint_generator>, C<has_inlined>, C<has_inline_generator>, C<has_parameters>
+=item C<has_parent>, C<has_library>, C<has_constraint_generator>, C<has_inlined>, C<has_inline_generator>, C<has_parameters>
Predicate methods.
+=item C<has_coercion>
+
+Predicate method with a little extra DWIM. Returns false if the coercion is
+a no-op.
+
=item C<< is_anon >>
Returns true iff the type constraint does not have a C<name>.
diff --git a/lib/Type/Tiny/Class.pm b/lib/Type/Tiny/Class.pm
index eea5886..5d11527 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.001';
+ $Type::Tiny::Class::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Tiny/Duck.pm b/lib/Type/Tiny/Duck.pm
index 523d4c8..c0ba6d7 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.001';
+ $Type::Tiny::Duck::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Tiny/Enum.pm b/lib/Type/Tiny/Enum.pm
index 0ab77ca..b5755d2 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.001';
+ $Type::Tiny::Enum::VERSION = '0.002';
}
sub _croak ($;@)
diff --git a/lib/Type/Tiny/Intersection.pm b/lib/Type/Tiny/Intersection.pm
index 68e0c04..0570527 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.001';
+ $Type::Tiny::Intersection::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Tiny/Manual.pod b/lib/Type/Tiny/Manual.pod
index 8b40d68..f84cbbc 100644
--- a/lib/Type/Tiny/Manual.pod
+++ b/lib/Type/Tiny/Manual.pod
@@ -59,6 +59,18 @@ use Type::Tiny pretty easily.
Type::Tiny is faster and supports coercions.
+=head1 BUGS
+
+Please report any bugs to
+L<http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
+
+=head1 SUPPORT
+
+B<< IRC: >> support is available through in the I<< #moose >> channel
+on L<irc.perl.org|http://www.irc.perl.org/channels.html>. If Type::Tiny
+discussion there becomes overwhelming (unlikely) then I'll move it
+to a separate channel.
+
=head1 CAVEATS
=head2 Mutability of Type::Coercion
diff --git a/lib/Type/Tiny/Role.pm b/lib/Type/Tiny/Role.pm
index 842a2fd..2615aa6 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.001';
+ $Type::Tiny::Role::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Tiny/Union.pm b/lib/Type/Tiny/Union.pm
index d4bcf39..7b95a68 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.001';
+ $Type::Tiny::Union::VERSION = '0.002';
}
use Scalar::Util qw< blessed >;
diff --git a/lib/Type/Utils.pm b/lib/Type/Utils.pm
index f697ac9..2d35e45 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.001';
+ $Type::Utils::VERSION = '0.002';
}
sub _croak ($;@) {
diff --git a/lib/Types/Standard.pm b/lib/Types/Standard.pm
index b5ebf73..8d81668 100644
--- a/lib/Types/Standard.pm
+++ b/lib/Types/Standard.pm
@@ -5,7 +5,7 @@ use warnings;
BEGIN {
$Types::Standard::AUTHORITY = 'cpan:TOBYINK';
- $Types::Standard::VERSION = '0.001';
+ $Types::Standard::VERSION = '0.002';
}
use base "Type::Library";
@@ -72,7 +72,9 @@ declare "Str",
_is_core => 1,
as "Value",
where { ref(\$_) eq 'SCALAR' or ref(\(my $val = $_)) eq 'SCALAR' },
- inline_as { "defined($_) and (ref(\\$_) eq 'SCALAR' or ref(\\(my \$val = $_)) eq 'SCALAR')" };
+ inline_as {
+ "defined($_) and do { ref(\\$_) eq 'SCALAR' or ref(\\(my \$val = $_)) eq 'SCALAR' }"
+ };
declare "Num",
_is_core => 1,
@@ -556,6 +558,17 @@ declare "StrMatch",
}
};
+declare "Bytes",
+ as "Str",
+ where { !utf8::is_utf8($_) },
+ inline_as { "!utf8::is_utf8($_)" };
+
+declare "Chars",
+ as "Str",
+ where { utf8::is_utf8($_) },
+ inline_as { "utf8::is_utf8($_)" };
+
+
1;
__END__
@@ -685,6 +698,14 @@ You can optionally provide a type constraint for the array of subexpressions:
],
];
+=item C<< Bytes >>
+
+Strings where C<< utf8::is_utf8() >> is false.
+
+=item C<< Chars >>
+
+Strings where C<< utf8::is_utf8() >> is true.
+
=back
=head1 BUGS
diff --git a/lib/Types/TypeTiny.pm b/lib/Types/TypeTiny.pm
index 365bbe0..d2180ea 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.001';
+our $VERSION = '0.002';
use Scalar::Util qw< blessed >;
diff --git a/meta/changes.pret b/meta/changes.pret
index 95b1030..748a363 100644
--- a/meta/changes.pret
+++ b/meta/changes.pret
@@ -7,6 +7,7 @@
`Type-Tiny 0.000_02 cpan:TOBYINK`
issued 2013-04-02;
changeset [
+ dcs:versus `Type-Tiny 0.000_01 cpan:TOBYINK`;
item "Beginnings of Type::Tiny::Manual."^^Documentation;
item "Anchor enum regexps to beginning and end of string."^^Bugfix;
item "StrMatch added to Type::Standard."^^Addition;
@@ -17,6 +18,7 @@
`Type-Tiny 0.000_03 cpan:TOBYINK`
issued 2013-04-03;
changeset [
+ dcs:versus `Type-Tiny 0.000_02 cpan:TOBYINK`;
item "Document Type::Coercion's overloading."^^Documentation;
item "Create and use compiled type constraint checks; much faster!"^^Change;
item "Inlined type constraints for all of Type::Standard."^^Addition;
@@ -29,6 +31,7 @@
`Type-Tiny 0.000_04 cpan:TOBYINK`
issued 2013-04-03;
changeset [
+ dcs:versus `Type-Tiny 0.000_03 cpan:TOBYINK`;
item "Create and use compiled coercions; somewhat faster."^^Change;
item "Type::Tiny plus_coercions/minus_coercions/no_coercions methods for creating subtypes with different sets of coercions."^^Addition;
item "Type::Tiny equals/is_subtype_of/is_supertype_of/is_a_type_of methods for type constraint comparisons."^^Addition;
@@ -39,6 +42,7 @@
`Type-Tiny 0.000_05 cpan:TOBYINK`
issued 2013-04-04;
changeset [
+ dcs:versus `Type-Tiny 0.000_04 cpan:TOBYINK`;
item "Factor out some functions from test suite into a new module: Test::TypeTiny."^^Addition;
item "Rearrange test suite slightly."^^Packaging;
item "Rename Type::Standard module to Types::Standard."^^Change;
@@ -53,6 +57,7 @@
`Type-Tiny 0.000_06 cpan:TOBYINK`
issued 2013-04-05;
changeset [
+ dcs:versus `Type-Tiny 0.000_05 cpan:TOBYINK`;
item "Monkey patch Moose::Meta::TypeConstraint to be able to retrieve Type::Tiny constraints from inflated Moose constraints."^^Addition;
item "More test cases."^^Packaging;
item "Improved documentation of parameterization attributes."^^Documentation;
@@ -72,6 +77,7 @@
`Type-Tiny 0.000_07 cpan:TOBYINK`
issued 2013-04-06;
changeset [
+ dcs:versus `Type-Tiny 0.000_06 cpan:TOBYINK`;
item "More test cases."^^Packaging;
item "Document constructor for Type::Tiny::Class."^^Documentation;
item "Fix inlining for Type::Tiny::Intersection."^^Bugfix;
@@ -83,6 +89,7 @@
`Type-Tiny 0.000_08 cpan:TOBYINK`
issued 2013-04-07;
changeset [
+ dcs:versus `Type-Tiny 0.000_07 cpan:TOBYINK`;
item "Rewrite most of the functions exported by Type::Library-based type libraries to cope better with being used mid-list."^^Change;
item "Most parts of the API that accept Type::Tiny objects (e.g. Type::Utils::from()) now also accept Moose::Meta::TypeConstraint objects."^^Change;
item "Types::TypeTiny::to_TypeTiny can be used to coerce a Moose type constraint object to Type::Tiny."^^Addition;
@@ -91,6 +98,7 @@
`Type-Tiny 0.000_09 cpan:TOBYINK`
issued 2013-04-08;
changeset [
+ dcs:versus `Type-Tiny 0.000_08 cpan:TOBYINK`;
item "Bundle benchmarking scripts."^^Addition;
item "Tidy up the 'examples' directory."^^Packaging;
item "When generating Moose/Mouse constraints from Type::Tiny objects, prefer to generate anonymous ones."^^Packaging;
@@ -100,6 +108,7 @@
`Type-Tiny 0.000_10 cpan:TOBYINK`
issued 2013-04-09;
changeset [
+ dcs:versus `Type-Tiny 0.000_09 cpan:TOBYINK`;
item "Improvements to has_coercion_for_{type,value} from Type::Coercion."^^Change;
item "Fix incorrect Test::Requires line in 'mouse-coercion.t'."^^Bugfix;
].
@@ -107,6 +116,7 @@
`Type-Tiny 0.000_11 cpan:TOBYINK`
issued 2013-04-11;
changeset [
+ dcs:versus `Type-Tiny 0.000_10 cpan:TOBYINK`;
item "Fix prototype for Type::Utils::as."^^Bugfix;
item "No longer need to pass '-moose' parameter when importing a library into a Moose class; only Mouse needs that treatment now."^^Change;
].
@@ -114,6 +124,7 @@
`Type-Tiny 0.000_12 cpan:TOBYINK`
issued 2013-04-12;
changeset [
+ dcs:versus `Type-Tiny 0.000_11 cpan:TOBYINK`;
item "Fix minor typo."^^Documentation;
].
@@ -121,6 +132,7 @@
issued 2013-04-15;
label "First public release";
changeset [
+ dcs:versus `Type-Tiny 0.000_12 cpan:TOBYINK`;
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;
@@ -129,3 +141,20 @@
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;
].
+
+`Type-Tiny 0.002 cpan:TOBYINK`
+ issued 2013-04-26;
+ changeset [
+ dcs:versus `Type-Tiny 0.001 cpan:TOBYINK`;
+ item "Link from Test::TypeTiny to Test::Deep::Type."^^Documentation;
+ item "Avoid unnecessarily regenerating parameterized type constraints."^^Change;
+ item "Make Type::Tiny's has_coercion method more DWIM."^^Change;
+ item "Chars and Bytes types added to Types::Standard."^^Addition;
+ item "Prevent warnings (about 'my $val' masking a previously declared variable) when several Str checks are being inlined in close proximity, such as Tuple[Str,Str]"^^Bugfix;
+ item [
+ a dcs:Bugfix;
+ label "Fix method conflicts when exporting type constraints to roles.";
+ dcs:thanks cpan:BOWTIE;
+ dcs:fixes [ dbug:reporter cpan:BOWTIE ];
+ ];
+ ].
diff --git a/meta/people.pret b/meta/people.pret
index 55745c9..7a05f03 100644
--- a/meta/people.pret
+++ b/meta/people.pret
@@ -11,6 +11,11 @@ cpan:TOBYINK
cpan:MSTROUT
:name "Matt S Trout".
+# Bug reports
+
+cpan:BOWTIE
+ :name "Kevin Dawson".
+
# We bundle some files made by these dudes...
cpan:RJBS
diff --git a/t/exporter-roleconflict.t b/t/exporter-roleconflict.t
new file mode 100644
index 0000000..e0400ca
--- /dev/null
+++ b/t/exporter-roleconflict.t
@@ -0,0 +1,62 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+Tests exporting to two roles; tries to avoid reporting conflicts.
+
+=head1 DEPENDENCIES
+
+Requires L<Role::Tiny> 1.000000; test skipped otherwise.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink at cpan.orgE<gt>.
+
+=head1 THANKS
+
+This test case is based on a script provided by Kevin Dawson.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2013 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw( ./lib ./t/lib ../inc ./inc );
+
+use Test::Requires { "Role::Tiny" => 1.000000 };
+use Test::More;
+use Test::Fatal;
+
+{
+ package Local::Role1;
+ use Role::Tiny;
+ use Types::Standard "Str";
+}
+
+{
+ package Local::Role2;
+ use Role::Tiny;
+ use Types::Standard "Str";
+}
+
+my $e = exception {
+ package Local::Class1;
+ use Role::Tiny::With;
+ with qw( Local::Role1 Local::Role2 );
+};
+
+use Scalar::Util "refaddr";
+note refaddr(\&Local::Role1::Str);
+note refaddr(\&Local::Role2::Str);
+
+is($e, undef);
+
+done_testing;
diff --git a/t/parameterization.t b/t/parameterization.t
new file mode 100644
index 0000000..1de2ba6
--- /dev/null
+++ b/t/parameterization.t
@@ -0,0 +1,41 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+There are loads of tests for parameterization in C<stdlib.t>,
+C<stdlib-overload.t>, C<stdlib-strmatch.t>, C<stdlib-structures.t>,
+C<syntax.t>, C<stdlib-automatic.t>, etc. This file includes a handful
+of other parameterization-related tests that didn't fit anywhere
+else.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink at cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2013 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw( ./lib ./t/lib ../inc ./inc );
+
+use Test::More;
+
+use Types::Standard -types;
+
+my $p1 = ArrayRef[Int];
+my $p2 = ArrayRef[Int];
+my $p3 = ArrayRef[Int->create_child_type()];
+
+is($p1->{uniq}, $p2->{uniq}, "Avoid duplicating parameterized types");
+isnt($p1->{uniq}, $p3->{uniq}, "... except when necessary!");
+
+done_testing;
diff --git a/t/stdlib-str.t b/t/stdlib-str.t
new file mode 100644
index 0000000..9e000da
--- /dev/null
+++ b/t/stdlib-str.t
@@ -0,0 +1,58 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+Checks various values against C<Bytes> and C<Chars> from Types::Standard.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink at cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2013 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw( . ./t ../inc ./inc );
+use utf8;
+
+use Test::More;
+use Test::TypeTiny;
+
+use Encode;
+use Types::Standard qw( Str Bytes Chars );
+use Type::Utils;
+
+my $chars = "café";
+my $bytes_utf8 = Encode::encode("utf-8", $chars);
+my $bytes_western = Encode::encode("iso-8859-1", $chars);
+
+is(length($chars), 4, 'length $chars == 4');
+is(length($bytes_utf8), 5, 'length $bytes_utf8 == 5');
+is(length($bytes_western), 4, 'length $bytes_western == 4');
+
+ok( utf8::is_utf8($chars), 'utf8::is_utf8 $chars');
+ok(!utf8::is_utf8($bytes_utf8), 'not utf8::is_utf8 $bytes_utf8');
+ok(!utf8::is_utf8($bytes_western), 'not utf8::is_utf8 $bytes_western');
+
+should_pass($chars, Str);
+should_pass($chars, Chars);
+should_fail($chars, Bytes);
+
+should_pass($bytes_utf8, Str);
+should_fail($bytes_utf8, Chars);
+should_pass($bytes_utf8, Bytes);
+
+should_pass($bytes_western, Str);
+should_fail($bytes_western, Chars);
+should_pass($bytes_western, Bytes);
+
+done_testing;
--
libtype-tiny-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list