Codebase list libparams-validationcompiler-perl / 4a27f2e
Merge tag 'upstream/0.23' Upstream version 0.23 Nick Morrott 7 years ago
18 changed file(s) with 1033 addition(s) and 197 deletion(s). Raw diff Collapse all Expand all
127127 request to the .mailmap file to contain the correct mapping.
128128
129129 This file was generated via Dist::Zilla::Plugin::GenerateFile::FromShareDir 0.013 from a
130 template file originating in Dist-Zilla-PluginBundle-DROLSKY-0.78.
130 template file originating in Dist-Zilla-PluginBundle-DROLSKY-0.80.
0 0.23 2017-01-23
1
2 - Trying to create a validator for positional parameters where a required
3 param came after one with a default did not throw an exception.
4
5 - A positional params validator with a slurpy type which had coercions did not
6 return the coerced values. It returned the original values instead.
7
8
09 0.22 2016-12-31
110
211 - Explicitly load the B module. Previously the code relied on this already
0 This software is Copyright (c) 2016 by Dave Rolsky.
0 This software is Copyright (c) 2016 - 2017 by Dave Rolsky.
11
22 This is free software, licensed under:
33
3535 t/specio.t
3636 t/type-tiny.t
3737 test-matrix.als
38 test-matrix.md
3938 tidyall.ini
4039 xt/author/00-compile.t
4140 xt/author/eol.t
41 xt/author/matrix.t
4242 xt/author/mojibake.t
4343 xt/author/no-tabs.t
4444 xt/author/pod-coverage.t
2323 "Code::TidyAll::Plugin::Test::Vars" : "0.02",
2424 "Const::Fast" : "0.014",
2525 "File::Spec" : "0",
26 "Hash::Merge" : "0",
2627 "Hash::Util" : "0",
2728 "IO::Handle" : "0",
2829 "IPC::Open3" : "0",
30 "List::AllUtils" : "0",
2931 "Moose" : "2.0000",
3032 "Parallel::ForkManager" : "1.19",
3133 "Perl::Critic" : "1.126",
3234 "Perl::Tidy" : "20160302",
3335 "Pod::Coverage::TrustPod" : "0",
3436 "Pod::Wordlist" : "0",
37 "Set::Scalar" : "0",
3538 "Specio" : "0.14",
3639 "Sub::Util" : "1.40",
40 "Test2::Bundle::Extended" : "0",
41 "Test2::Plugin::NoWarnings" : "0",
42 "Test2::Require::Perl" : "0",
3743 "Test::CPAN::Changes" : "0.19",
3844 "Test::CPAN::Meta::JSON" : "0.16",
3945 "Test::Code::TidyAll" : "0.50",
4955 "Test::Vars" : "0.009",
5056 "Test::Version" : "2.05",
5157 "Type::Tiny" : "0",
58 "Type::Utils" : "0",
5259 "blib" : "1.01",
5360 "perl" : "5.006"
5461 }
9097 "provides" : {
9198 "Params::ValidationCompiler" : {
9299 "file" : "lib/Params/ValidationCompiler.pm",
93 "version" : "0.22"
100 "version" : "0.23"
94101 },
95102 "Params::ValidationCompiler::Compiler" : {
96103 "file" : "lib/Params/ValidationCompiler/Compiler.pm",
97 "version" : "0.22"
104 "version" : "0.23"
98105 },
99106 "Params::ValidationCompiler::Exceptions" : {
100107 "file" : "lib/Params/ValidationCompiler/Exceptions.pm",
101 "version" : "0.22"
108 "version" : "0.23"
102109 }
103110 },
104111 "release_status" : "stable",
113120 "web" : "https://github.com/houseabsolute/Params-ValidationCompiler"
114121 }
115122 },
116 "version" : 0.22,
123 "version" : "0.23",
117124 "x_Dist_Zilla" : {
118125 "perl" : {
119126 "version" : "5.024000"
200207 "version" : "6.008"
201208 },
202209 {
203 "class" : "Dist::Zilla::Plugin::DROLSKY::VersionProvider",
204 "name" : "@DROLSKY/DROLSKY::VersionProvider",
205 "version" : "0.78"
210 "class" : "Dist::Zilla::Plugin::VersionFromMainModule",
211 "name" : "@DROLSKY/VersionFromMainModule",
212 "version" : "0.02"
206213 },
207214 {
208215 "class" : "Dist::Zilla::Plugin::Authority",
259266 "meta_noindex" : 1
260267 },
261268 "Dist::Zilla::Role::ModuleMetadata" : {
262 "Module::Metadata" : "1.000033",
269 "Module::Metadata" : "1.000031",
263270 "version" : "0.003"
264271 }
265272 },
351358 "phase" : "release",
352359 "run_under_travis" : 0,
353360 "skip" : [
354 "Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent",
355361 "Dist::Zilla::Plugin::DROLSKY::Contributors",
356362 "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch",
357363 "Dist::Zilla::Plugin::DROLSKY::License",
358364 "Dist::Zilla::Plugin::DROLSKY::TidyAll",
359 "Dist::Zilla::Plugin::DROLSKY::VersionProvider",
360365 "Pod::Weaver::PluginBundle::DROLSKY"
361366 ]
362367 }
519524 {
520525 "class" : "Dist::Zilla::Plugin::DROLSKY::Contributors",
521526 "name" : "@DROLSKY/DROLSKY::Contributors",
522 "version" : "0.78"
527 "version" : "0.80"
523528 },
524529 {
525530 "class" : "Dist::Zilla::Plugin::Git::Contributors",
526531 "config" : {
527532 "Dist::Zilla::Plugin::Git::Contributors" : {
528 "git --version" : "2.11.0",
533 "git --version" : "2.7.4",
529534 "include_authors" : 0,
530535 "include_releaser" : 1,
531536 "order_by" : "name",
550555 {
551556 "class" : "Pod::Weaver::Plugin::EnsurePod5",
552557 "name" : "@CorePrep/EnsurePod5",
553 "version" : "4.015"
558 "version" : "4.013"
554559 },
555560 {
556561 "class" : "Pod::Weaver::Plugin::H1Nester",
557562 "name" : "@CorePrep/H1Nester",
558 "version" : "4.015"
563 "version" : "4.013"
559564 },
560565 {
561566 "class" : "Pod::Weaver::Plugin::SingleEncoding",
562567 "name" : "@DROLSKY/SingleEncoding",
563 "version" : "4.015"
568 "version" : "4.013"
564569 },
565570 {
566571 "class" : "Pod::Weaver::Plugin::Transformer",
567572 "name" : "@DROLSKY/List",
568 "version" : "4.015"
573 "version" : "4.013"
569574 },
570575 {
571576 "class" : "Pod::Weaver::Plugin::Transformer",
572577 "name" : "@DROLSKY/Verbatim",
573 "version" : "4.015"
578 "version" : "4.013"
574579 },
575580 {
576581 "class" : "Pod::Weaver::Section::Region",
577582 "name" : "@DROLSKY/header",
578 "version" : "4.015"
583 "version" : "4.013"
579584 },
580585 {
581586 "class" : "Pod::Weaver::Section::Name",
582587 "name" : "@DROLSKY/Name",
583 "version" : "4.015"
588 "version" : "4.013"
584589 },
585590 {
586591 "class" : "Pod::Weaver::Section::Version",
587592 "name" : "@DROLSKY/Version",
588 "version" : "4.015"
593 "version" : "4.013"
589594 },
590595 {
591596 "class" : "Pod::Weaver::Section::Region",
592597 "name" : "@DROLSKY/prelude",
593 "version" : "4.015"
598 "version" : "4.013"
594599 },
595600 {
596601 "class" : "Pod::Weaver::Section::Generic",
597602 "name" : "SYNOPSIS",
598 "version" : "4.015"
603 "version" : "4.013"
599604 },
600605 {
601606 "class" : "Pod::Weaver::Section::Generic",
602607 "name" : "DESCRIPTION",
603 "version" : "4.015"
608 "version" : "4.013"
604609 },
605610 {
606611 "class" : "Pod::Weaver::Section::Generic",
607612 "name" : "OVERVIEW",
608 "version" : "4.015"
613 "version" : "4.013"
609614 },
610615 {
611616 "class" : "Pod::Weaver::Section::Collect",
612617 "name" : "ATTRIBUTES",
613 "version" : "4.015"
618 "version" : "4.013"
614619 },
615620 {
616621 "class" : "Pod::Weaver::Section::Collect",
617622 "name" : "METHODS",
618 "version" : "4.015"
623 "version" : "4.013"
619624 },
620625 {
621626 "class" : "Pod::Weaver::Section::Collect",
622627 "name" : "FUNCTIONS",
623 "version" : "4.015"
628 "version" : "4.013"
624629 },
625630 {
626631 "class" : "Pod::Weaver::Section::Collect",
627632 "name" : "TYPES",
628 "version" : "4.015"
633 "version" : "4.013"
629634 },
630635 {
631636 "class" : "Pod::Weaver::Section::Leftovers",
632637 "name" : "@DROLSKY/Leftovers",
633 "version" : "4.015"
638 "version" : "4.013"
634639 },
635640 {
636641 "class" : "Pod::Weaver::Section::Region",
637642 "name" : "@DROLSKY/postlude",
638 "version" : "4.015"
643 "version" : "4.013"
639644 },
640645 {
641646 "class" : "Pod::Weaver::Section::GenerateSection",
642647 "name" : "@DROLSKY/generate SUPPORT",
643 "version" : "1.02"
648 "version" : "1.01"
644649 },
645650 {
646651 "class" : "Pod::Weaver::Section::AllowOverride",
649654 },
650655 {
651656 "class" : "Pod::Weaver::Section::GenerateSection",
657 "name" : "@DROLSKY/generate SOURCE",
658 "version" : "1.01"
659 },
660 {
661 "class" : "Pod::Weaver::Section::GenerateSection",
652662 "name" : "@DROLSKY/generate DONATIONS",
653 "version" : "1.02"
663 "version" : "1.01"
654664 },
655665 {
656666 "class" : "Pod::Weaver::Section::Authors",
657667 "name" : "@DROLSKY/Authors",
658 "version" : "4.015"
668 "version" : "4.013"
659669 },
660670 {
661671 "class" : "Pod::Weaver::Section::Contributors",
665675 {
666676 "class" : "Pod::Weaver::Section::Legal",
667677 "name" : "@DROLSKY/Legal",
668 "version" : "4.015"
678 "version" : "4.013"
669679 },
670680 {
671681 "class" : "Pod::Weaver::Section::Region",
672682 "name" : "@DROLSKY/footer",
673 "version" : "4.015"
683 "version" : "4.013"
674684 }
675685 ]
676686 }
681691 {
682692 "class" : "Dist::Zilla::Plugin::DROLSKY::WeaverConfig",
683693 "name" : "@DROLSKY/DROLSKY::WeaverConfig",
684 "version" : "0.78"
694 "version" : "0.80"
685695 },
686696 {
687697 "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
726736 {
727737 "class" : "Dist::Zilla::Plugin::DROLSKY::License",
728738 "name" : "@DROLSKY/DROLSKY::License",
729 "version" : "0.78"
739 "version" : "0.80"
730740 },
731741 {
732742 "class" : "Dist::Zilla::Plugin::CheckStrictVersion",
742752 ]
743753 },
744754 "Dist::Zilla::Role::ModuleMetadata" : {
745 "Module::Metadata" : "1.000033",
755 "Module::Metadata" : "1.000031",
746756 "version" : "0.003"
747757 }
748758 },
755765 "version" : "0.020"
756766 },
757767 {
758 "class" : "Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent",
759 "name" : "@DROLSKY/DROLSKY::CheckChangesHasContent",
760 "version" : "0.78"
761 },
762 {
763768 "class" : "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch",
764769 "config" : {
765770 "Dist::Zilla::Role::Git::Repo" : {
766 "git --version" : "2.11.0",
771 "git --version" : "2.7.4",
767772 "repo_root" : "."
768773 }
769774 },
770775 "name" : "@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch",
771 "version" : "0.78"
776 "version" : "0.80"
777 },
778 {
779 "class" : "Dist::Zilla::Plugin::EnsureChangesHasContent",
780 "name" : "@DROLSKY/EnsureChangesHasContent",
781 "version" : "0.02"
772782 },
773783 {
774784 "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts",
775785 "config" : {
776786 "Dist::Zilla::Role::Git::Repo" : {
777 "git --version" : "2.11.0",
787 "git --version" : "2.7.4",
778788 "repo_root" : "."
779789 }
780790 },
784794 {
785795 "class" : "Dist::Zilla::Plugin::DROLSKY::TidyAll",
786796 "name" : "@DROLSKY/DROLSKY::TidyAll",
787 "version" : "0.78"
797 "version" : "0.80"
788798 },
789799 {
790800 "class" : "Dist::Zilla::Plugin::Git::Check",
806816 "changelog" : "Changes"
807817 },
808818 "Dist::Zilla::Role::Git::Repo" : {
809 "git --version" : "2.11.0",
819 "git --version" : "2.7.4",
810820 "repo_root" : "."
811821 }
812822 },
834844 "changelog" : "Changes"
835845 },
836846 "Dist::Zilla::Role::Git::Repo" : {
837 "git --version" : "2.11.0",
847 "git --version" : "2.7.4",
838848 "repo_root" : "."
839849 },
840850 "Dist::Zilla::Role::Git::StringFormatter" : {
851861 "branch" : null,
852862 "changelog" : "Changes",
853863 "signed" : 0,
854 "tag" : "v0.22",
864 "tag" : "v0.23",
855865 "tag_format" : "v%v",
856866 "tag_message" : "v%v"
857867 },
858868 "Dist::Zilla::Role::Git::Repo" : {
859 "git --version" : "2.11.0",
869 "git --version" : "2.7.4",
860870 "repo_root" : "."
861871 },
862872 "Dist::Zilla::Role::Git::StringFormatter" : {
876886 "remotes_must_exist" : 1
877887 },
878888 "Dist::Zilla::Role::Git::Repo" : {
879 "git --version" : "2.11.0",
889 "git --version" : "2.7.4",
880890 "repo_root" : "."
881891 }
882892 },
916926 "changelog" : "Changes"
917927 },
918928 "Dist::Zilla::Role::Git::Repo" : {
919 "git --version" : "2.11.0",
929 "git --version" : "2.7.4",
920930 "repo_root" : "."
921931 },
922932 "Dist::Zilla::Role::Git::StringFormatter" : {
936946 "remotes_must_exist" : 1
937947 },
938948 "Dist::Zilla::Role::Git::Repo" : {
939 "git --version" : "2.11.0",
949 "git --version" : "2.7.4",
940950 "repo_root" : "."
941951 }
942952 },
10451055 "Gregory Oschwald <goschwald@maxmind.com>",
10461056 "Tomasz Konojacki <me@xenu.pl>"
10471057 ],
1048 "x_serialization_backend" : "Cpanel::JSON::XS version 3.0225"
1058 "x_serialization_backend" : "Cpanel::JSON::XS version 3.0213"
10491059 }
10501060
2323 provides:
2424 Params::ValidationCompiler:
2525 file: lib/Params/ValidationCompiler.pm
26 version: '0.22'
26 version: '0.23'
2727 Params::ValidationCompiler::Compiler:
2828 file: lib/Params/ValidationCompiler/Compiler.pm
29 version: '0.22'
29 version: '0.23'
3030 Params::ValidationCompiler::Exceptions:
3131 file: lib/Params/ValidationCompiler/Exceptions.pm
32 version: '0.22'
32 version: '0.23'
3333 recommends:
3434 Sub::Util: '1.40'
3535 requires:
4747 bugtracker: https://github.com/houseabsolute/Params-ValidationCompiler/issues
4848 homepage: http://metacpan.org/release/Params-ValidationCompiler
4949 repository: git://github.com/houseabsolute/Params-ValidationCompiler.git
50 version: '0.22'
50 version: '0.23'
5151 x_Dist_Zilla:
5252 perl:
5353 version: '5.024000'
116116 name: '@DROLSKY/UploadToCPAN'
117117 version: '6.008'
118118 -
119 class: Dist::Zilla::Plugin::DROLSKY::VersionProvider
120 name: '@DROLSKY/DROLSKY::VersionProvider'
121 version: '0.78'
119 class: Dist::Zilla::Plugin::VersionFromMainModule
120 name: '@DROLSKY/VersionFromMainModule'
121 version: '0.02'
122122 -
123123 class: Dist::Zilla::Plugin::Authority
124124 name: '@DROLSKY/Authority'
162162 inherit_version: '1'
163163 meta_noindex: '1'
164164 Dist::Zilla::Role::ModuleMetadata:
165 Module::Metadata: '1.000033'
165 Module::Metadata: '1.000031'
166166 version: '0.003'
167167 name: '@DROLSKY/MetaProvides::Package'
168168 version: '2.004002'
233233 phase: release
234234 run_under_travis: 0
235235 skip:
236 - Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent
237236 - Dist::Zilla::Plugin::DROLSKY::Contributors
238237 - Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch
239238 - Dist::Zilla::Plugin::DROLSKY::License
240239 - Dist::Zilla::Plugin::DROLSKY::TidyAll
241 - Dist::Zilla::Plugin::DROLSKY::VersionProvider
242240 - Pod::Weaver::PluginBundle::DROLSKY
243241 name: '@DROLSKY/PromptIfStale'
244242 version: '0.051'
362360 -
363361 class: Dist::Zilla::Plugin::DROLSKY::Contributors
364362 name: '@DROLSKY/DROLSKY::Contributors'
365 version: '0.78'
363 version: '0.80'
366364 -
367365 class: Dist::Zilla::Plugin::Git::Contributors
368366 config:
369367 Dist::Zilla::Plugin::Git::Contributors:
370 'git --version': 2.11.0
368 'git --version': 2.7.4
371369 include_authors: 0
372370 include_releaser: 1
373371 order_by: name
387385 -
388386 class: Pod::Weaver::Plugin::EnsurePod5
389387 name: '@CorePrep/EnsurePod5'
390 version: '4.015'
388 version: '4.013'
391389 -
392390 class: Pod::Weaver::Plugin::H1Nester
393391 name: '@CorePrep/H1Nester'
394 version: '4.015'
392 version: '4.013'
395393 -
396394 class: Pod::Weaver::Plugin::SingleEncoding
397395 name: '@DROLSKY/SingleEncoding'
398 version: '4.015'
396 version: '4.013'
399397 -
400398 class: Pod::Weaver::Plugin::Transformer
401399 name: '@DROLSKY/List'
402 version: '4.015'
400 version: '4.013'
403401 -
404402 class: Pod::Weaver::Plugin::Transformer
405403 name: '@DROLSKY/Verbatim'
406 version: '4.015'
404 version: '4.013'
407405 -
408406 class: Pod::Weaver::Section::Region
409407 name: '@DROLSKY/header'
410 version: '4.015'
408 version: '4.013'
411409 -
412410 class: Pod::Weaver::Section::Name
413411 name: '@DROLSKY/Name'
414 version: '4.015'
412 version: '4.013'
415413 -
416414 class: Pod::Weaver::Section::Version
417415 name: '@DROLSKY/Version'
418 version: '4.015'
416 version: '4.013'
419417 -
420418 class: Pod::Weaver::Section::Region
421419 name: '@DROLSKY/prelude'
422 version: '4.015'
420 version: '4.013'
423421 -
424422 class: Pod::Weaver::Section::Generic
425423 name: SYNOPSIS
426 version: '4.015'
424 version: '4.013'
427425 -
428426 class: Pod::Weaver::Section::Generic
429427 name: DESCRIPTION
430 version: '4.015'
428 version: '4.013'
431429 -
432430 class: Pod::Weaver::Section::Generic
433431 name: OVERVIEW
434 version: '4.015'
432 version: '4.013'
435433 -
436434 class: Pod::Weaver::Section::Collect
437435 name: ATTRIBUTES
438 version: '4.015'
436 version: '4.013'
439437 -
440438 class: Pod::Weaver::Section::Collect
441439 name: METHODS
442 version: '4.015'
440 version: '4.013'
443441 -
444442 class: Pod::Weaver::Section::Collect
445443 name: FUNCTIONS
446 version: '4.015'
444 version: '4.013'
447445 -
448446 class: Pod::Weaver::Section::Collect
449447 name: TYPES
450 version: '4.015'
448 version: '4.013'
451449 -
452450 class: Pod::Weaver::Section::Leftovers
453451 name: '@DROLSKY/Leftovers'
454 version: '4.015'
452 version: '4.013'
455453 -
456454 class: Pod::Weaver::Section::Region
457455 name: '@DROLSKY/postlude'
458 version: '4.015'
456 version: '4.013'
459457 -
460458 class: Pod::Weaver::Section::GenerateSection
461459 name: '@DROLSKY/generate SUPPORT'
462 version: '1.02'
460 version: '1.01'
463461 -
464462 class: Pod::Weaver::Section::AllowOverride
465463 name: '@DROLSKY/allow override SUPPORT'
466464 version: '0.05'
467465 -
468466 class: Pod::Weaver::Section::GenerateSection
467 name: '@DROLSKY/generate SOURCE'
468 version: '1.01'
469 -
470 class: Pod::Weaver::Section::GenerateSection
469471 name: '@DROLSKY/generate DONATIONS'
470 version: '1.02'
472 version: '1.01'
471473 -
472474 class: Pod::Weaver::Section::Authors
473475 name: '@DROLSKY/Authors'
474 version: '4.015'
476 version: '4.013'
475477 -
476478 class: Pod::Weaver::Section::Contributors
477479 name: '@DROLSKY/Contributors'
479481 -
480482 class: Pod::Weaver::Section::Legal
481483 name: '@DROLSKY/Legal'
482 version: '4.015'
484 version: '4.013'
483485 -
484486 class: Pod::Weaver::Section::Region
485487 name: '@DROLSKY/footer'
486 version: '4.015'
488 version: '4.013'
487489 name: '@DROLSKY/SurgicalPodWeaver'
488490 version: '0.0023'
489491 -
490492 class: Dist::Zilla::Plugin::DROLSKY::WeaverConfig
491493 name: '@DROLSKY/DROLSKY::WeaverConfig'
492 version: '0.78'
494 version: '0.80'
493495 -
494496 class: Dist::Zilla::Plugin::ReadmeAnyFromPod
495497 config:
524526 -
525527 class: Dist::Zilla::Plugin::DROLSKY::License
526528 name: '@DROLSKY/DROLSKY::License'
527 version: '0.78'
529 version: '0.80'
528530 -
529531 class: Dist::Zilla::Plugin::CheckStrictVersion
530532 name: '@DROLSKY/CheckStrictVersion'
536538 finder:
537539 - ':InstallModules'
538540 Dist::Zilla::Role::ModuleMetadata:
539 Module::Metadata: '1.000033'
541 Module::Metadata: '1.000031'
540542 version: '0.003'
541543 name: '@DROLSKY/CheckSelfDependency'
542544 version: '0.011'
545547 name: '@DROLSKY/CheckPrereqsIndexed'
546548 version: '0.020'
547549 -
548 class: Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent
549 name: '@DROLSKY/DROLSKY::CheckChangesHasContent'
550 version: '0.78'
551 -
552550 class: Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch
553551 config:
554552 Dist::Zilla::Role::Git::Repo:
555 'git --version': 2.11.0
553 'git --version': 2.7.4
556554 repo_root: .
557555 name: '@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch'
558 version: '0.78'
556 version: '0.80'
557 -
558 class: Dist::Zilla::Plugin::EnsureChangesHasContent
559 name: '@DROLSKY/EnsureChangesHasContent'
560 version: '0.02'
559561 -
560562 class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts
561563 config:
562564 Dist::Zilla::Role::Git::Repo:
563 'git --version': 2.11.0
565 'git --version': 2.7.4
564566 repo_root: .
565567 name: '@DROLSKY/Git::CheckFor::MergeConflicts'
566568 version: '0.014'
567569 -
568570 class: Dist::Zilla::Plugin::DROLSKY::TidyAll
569571 name: '@DROLSKY/DROLSKY::TidyAll'
570 version: '0.78'
572 version: '0.80'
571573 -
572574 class: Dist::Zilla::Plugin::Git::Check
573575 config:
585587 allow_dirty_match: []
586588 changelog: Changes
587589 Dist::Zilla::Role::Git::Repo:
588 'git --version': 2.11.0
590 'git --version': 2.7.4
589591 repo_root: .
590592 name: '@DROLSKY/Git::Check'
591593 version: '2.041'
607609 allow_dirty_match: []
608610 changelog: Changes
609611 Dist::Zilla::Role::Git::Repo:
610 'git --version': 2.11.0
612 'git --version': 2.7.4
611613 repo_root: .
612614 Dist::Zilla::Role::Git::StringFormatter:
613615 time_zone: local
620622 branch: ~
621623 changelog: Changes
622624 signed: 0
623 tag: v0.22
625 tag: v0.23
624626 tag_format: v%v
625627 tag_message: v%v
626628 Dist::Zilla::Role::Git::Repo:
627 'git --version': 2.11.0
629 'git --version': 2.7.4
628630 repo_root: .
629631 Dist::Zilla::Role::Git::StringFormatter:
630632 time_zone: local
638640 - origin
639641 remotes_must_exist: 1
640642 Dist::Zilla::Role::Git::Repo:
641 'git --version': 2.11.0
643 'git --version': 2.7.4
642644 repo_root: .
643645 name: '@DROLSKY/Git::Push'
644646 version: '2.041'
667669 - (?^:.+)
668670 changelog: Changes
669671 Dist::Zilla::Role::Git::Repo:
670 'git --version': 2.11.0
672 'git --version': 2.7.4
671673 repo_root: .
672674 Dist::Zilla::Role::Git::StringFormatter:
673675 time_zone: local
681683 - origin
682684 remotes_must_exist: 1
683685 Dist::Zilla::Role::Git::Repo:
684 'git --version': 2.11.0
686 'git --version': 2.7.4
685687 repo_root: .
686688 name: '@DROLSKY/Push version bump'
687689 version: '2.041'
3737 "Test::More" => "1.302015",
3838 "Test::Without::Module" => 0
3939 },
40 "VERSION" => "0.22",
40 "VERSION" => "0.23",
4141 "test" => {
4242 "TESTS" => "t/*.t t/named/*.t t/positional/*.t"
4343 }
33
44 # VERSION
55
6 version 0.22
6 version 0.23
77
88 # SYNOPSIS
99
179179
180180 # SUPPORT
181181
182 Bugs may be submitted through [https://github.com/houseabsolute/Params-ValidationCompiler/issues](https://github.com/houseabsolute/Params-ValidationCompiler/issues).
182 Bugs may be submitted at [https://github.com/houseabsolute/Params-ValidationCompiler/issues](https://github.com/houseabsolute/Params-ValidationCompiler/issues).
183183
184184 I am also usually active on IRC as 'autarch' on `irc://irc.perl.org`.
185
186 # SOURCE
187
188 The source code repository for Params-ValidationCompiler can be found at [https://github.com/houseabsolute/Params-ValidationCompiler](https://github.com/houseabsolute/Params-ValidationCompiler).
185189
186190 # DONATIONS
187191
211215
212216 # COPYRIGHT AND LICENSE
213217
214 This software is Copyright (c) 2016 by Dave Rolsky.
218 This software is Copyright (c) 2016 - 2017 by Dave Rolsky.
215219
216220 This is free software, licensed under:
217221
218222 The Artistic License 2.0 (GPL Compatible)
223
224 The full text of the license can be found in the
225 `LICENSE` file included with this distribution.
3333 requires "Code::TidyAll::Plugin::Test::Vars" => "0.02";
3434 requires "Const::Fast" => "0.014";
3535 requires "File::Spec" => "0";
36 requires "Hash::Merge" => "0";
3637 requires "Hash::Util" => "0";
3738 requires "IO::Handle" => "0";
3839 requires "IPC::Open3" => "0";
40 requires "List::AllUtils" => "0";
3941 requires "Moose" => "2.0000";
4042 requires "Parallel::ForkManager" => "1.19";
4143 requires "Perl::Critic" => "1.126";
4244 requires "Perl::Tidy" => "20160302";
4345 requires "Pod::Coverage::TrustPod" => "0";
4446 requires "Pod::Wordlist" => "0";
47 requires "Set::Scalar" => "0";
4548 requires "Specio" => "0.14";
4649 requires "Sub::Util" => "1.40";
50 requires "Test2::Bundle::Extended" => "0";
51 requires "Test2::Plugin::NoWarnings" => "0";
52 requires "Test2::Require::Perl" => "0";
4753 requires "Test::CPAN::Changes" => "0.19";
4854 requires "Test::CPAN::Meta::JSON" => "0.16";
4955 requires "Test::Code::TidyAll" => "0.50";
5965 requires "Test::Vars" => "0.009";
6066 requires "Test::Version" => "2.05";
6167 requires "Type::Tiny" => "0";
68 requires "Type::Utils" => "0";
6269 requires "blib" => "1.01";
6370 requires "perl" => "5.006";
6471 };
11 author = Dave Rolsky <autarch@urth.org>
22 license = Artistic_2_0
33 copyright_holder = Dave Rolsky
4 copyright_year = 2016
45
56 [@DROLSKY]
67 dist = Params-ValidationCompiler
1819 -remove = Test::CleanNamespaces
1920
2021 [Prereqs / DevelopRequires]
21 Const::Fast = 0.014
22 Hash::Util = 0
23 Moose = 2.0000
24 Specio = 0.14
25 Sub::Util = 1.40
26 Type::Tiny = 0
22 Const::Fast = 0.014
23 Hash::Util = 0
24 Moose = 2.0000
25 Specio = 0.14
26 Sub::Util = 1.40
27 Type::Tiny = 0
2728
2829 [Prereqs / Recommends]
2930 Sub::Util = 1.40
22 use strict;
33 use warnings;
44
5 our $VERSION = '0.22';
5 our $VERSION = '0.23';
66
77 use Carp qw( croak );
88 use Eval::Closure qw( eval_closure );
177177 sub _types {
178178 my $self = shift;
179179
180 my @types;
180181 if ( ref $self->params eq 'HASH' ) {
181 return map { $_->{type} || () }
182 @types = map { $_->{type} || () }
182183 grep { ref $_ } values %{ $self->params };
183184 }
184185 elsif ( ref $self->params eq 'ARRAY' ) {
185186 if ( $self->named_to_list ) {
186187 my %p = @{ $self->params };
187 return map { $_->{type} || () } grep { ref $_ } values %p;
188 @types = map { $_->{type} || () } grep { ref $_ } values %p;
188189 }
189190 else {
190 return
191 map { $_->{type} || () } grep { ref $_ } @{ $self->params };
192 }
193 }
191 @types
192 = map { $_->{type} || () } grep { ref $_ } @{ $self->params };
193 }
194 }
195
196 push @types, $self->slurpy if $self->slurpy && ref $self->slurpy;
197
198 return @types;
194199 }
195200
196201 sub subref {
285290 # We check exists $spec->{optional} so as not to blow up on a
286291 # restricted hash.
287292 $self->_add_check_for_required_named_param( $access, $name )
288 unless ( exists $spec->{optional} && $spec->{optional} )
289 || exists $spec->{default};
293 unless $spec->{optional} || exists $spec->{default};
290294
291295 $self->_add_named_default_assignment(
292296 $access,
478482 $self->_add_check_for_extra_positional_param_types(
479483 scalar @specs,
480484 $self->slurpy,
485 $access_var,
481486 );
482487 }
483488
494499
495500 for my $spec ( @{ $self->params } ) {
496501 $spec = ref $spec ? $spec : { optional => !$spec };
497 if ( $spec->{optional} ) {
502 if ( $spec->{optional} || exists $spec->{default} ) {
498503 $in_optional = 1;
499504 }
500505 elsif ($in_optional) {
528533 }
529534
530535 sub _add_check_for_extra_positional_param_types {
531 my $self = shift;
532 my $max = shift;
533 my $type = shift;
536 my $self = shift;
537 my $max = shift;
538 my $type = shift;
539 my $access_var = shift;
534540
535541 # We need to set the name argument to something that won't conflict with
536542 # names someone would actually use for a parameter.
537543 my $check = join q{}, $self->_type_check(
538 '$_[$i]',
544 sprintf( '%s[$i]', $access_var ),
539545 '__PCC extra parameters__',
540546 $type,
541547 );
896902
897903 =head1 VERSION
898904
899 version 0.22
905 version 0.23
900906
901907 =for Pod::Coverage .*
902908
903909 =head1 SUPPORT
904910
905 Bugs may be submitted through L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.
911 Bugs may be submitted at L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.
906912
907913 I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
908914
915 =head1 SOURCE
916
917 The source code repository for Params-ValidationCompiler can be found at L<https://github.com/houseabsolute/Params-ValidationCompiler>.
918
909919 =head1 AUTHOR
910920
911921 Dave Rolsky <autarch@urth.org>
912922
913923 =head1 COPYRIGHT AND LICENSE
914924
915 This software is Copyright (c) 2016 by Dave Rolsky.
925 This software is Copyright (c) 2016 - 2017 by Dave Rolsky.
916926
917927 This is free software, licensed under:
918928
919929 The Artistic License 2.0 (GPL Compatible)
920930
931 The full text of the license can be found in the
932 F<LICENSE> file included with this distribution.
933
921934 =cut
22 use strict;
33 use warnings;
44
5 our $VERSION = '0.22';
5 our $VERSION = '0.23';
66
77 use Exception::Class (
88 'Params::ValidationCompiler::Exception::BadArguments',
4040
4141 =head1 VERSION
4242
43 version 0.22
43 version 0.23
4444
4545 =head1 DESCRIPTION
4646
8686
8787 =head1 SUPPORT
8888
89 Bugs may be submitted through L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.
89 Bugs may be submitted at L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.
9090
9191 I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
92
93 =head1 SOURCE
94
95 The source code repository for Params-ValidationCompiler can be found at L<https://github.com/houseabsolute/Params-ValidationCompiler>.
9296
9397 =head1 AUTHOR
9498
96100
97101 =head1 COPYRIGHT AND LICENSE
98102
99 This software is Copyright (c) 2016 by Dave Rolsky.
103 This software is Copyright (c) 2016 - 2017 by Dave Rolsky.
100104
101105 This is free software, licensed under:
102106
103107 The Artistic License 2.0 (GPL Compatible)
104108
109 The full text of the license can be found in the
110 F<LICENSE> file included with this distribution.
111
105112 =cut
22 use strict;
33 use warnings;
44
5 our $VERSION = '0.22';
5 our $VERSION = '0.23';
66
77 use Params::ValidationCompiler::Compiler;
88
3939
4040 =head1 VERSION
4141
42 version 0.22
42 version 0.23
4343
4444 =head1 SYNOPSIS
4545
229229
230230 =head1 SUPPORT
231231
232 Bugs may be submitted through L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.
232 Bugs may be submitted at L<https://github.com/houseabsolute/Params-ValidationCompiler/issues>.
233233
234234 I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
235
236 =head1 SOURCE
237
238 The source code repository for Params-ValidationCompiler can be found at L<https://github.com/houseabsolute/Params-ValidationCompiler>.
235239
236240 =head1 DONATIONS
237241
272276
273277 =head1 COPYRIGHT AND LICENSE
274278
275 This software is Copyright (c) 2016 by Dave Rolsky.
279 This software is Copyright (c) 2016 - 2017 by Dave Rolsky.
276280
277281 This is free software, licensed under:
278282
279283 The Artistic License 2.0 (GPL Compatible)
280284
285 The full text of the license can be found in the
286 F<LICENSE> file included with this distribution.
287
281288 =cut
88 'Code::TidyAll::Plugin::Test::Vars' => '0.02',
99 'Const::Fast' => '0.014',
1010 'File::Spec' => '0',
11 'Hash::Merge' => '0',
1112 'Hash::Util' => '0',
1213 'IO::Handle' => '0',
1314 'IPC::Open3' => '0',
15 'List::AllUtils' => '0',
1416 'Moose' => '2.0000',
1517 'Parallel::ForkManager' => '1.19',
1618 'Perl::Critic' => '1.126',
1719 'Perl::Tidy' => '20160302',
1820 'Pod::Coverage::TrustPod' => '0',
1921 'Pod::Wordlist' => '0',
22 'Set::Scalar' => '0',
2023 'Specio' => '0.14',
2124 'Sub::Util' => '1.40',
25 'Test2::Bundle::Extended' => '0',
26 'Test2::Plugin::NoWarnings' => '0',
27 'Test2::Require::Perl' => '0',
2228 'Test::CPAN::Changes' => '0.19',
2329 'Test::CPAN::Meta::JSON' => '0.16',
2430 'Test::Code::TidyAll' => '0.50',
3440 'Test::Vars' => '0.009',
3541 'Test::Version' => '2.05',
3642 'Type::Tiny' => '0',
43 'Type::Utils' => '0',
3744 'blib' => '1.01',
3845 'perl' => '5.006'
3946 }
3636 );
3737 }
3838
39 {
40 like(
41 dies {
42 validation_for(
43 params => [
44 { optional => 1 },
45 { type => t('Int') },
46 ],
47 );
48 },
49 qr/\QParameter list contains an optional parameter followed by a required parameter/,
50 'cann have positional parameters where an optional param comes before a required one'
51 );
52
53 like(
54 dies {
55 validation_for(
56 params => [
57 { default => 42 },
58 { type => t('Int') },
59 ],
60 );
61 },
62 qr/\QParameter list contains an optional parameter followed by a required parameter/,
63 'cann have positional parameters where a param with a default comes before a required one'
64 );
65 }
66
3967 done_testing();
+0
-51
test-matrix.md less more
0 ## Parameter specs
1
2 ### Type
3
4 * No type, just required
5 * Has a type -> [Types](#types)
6
7 ### Required or not
8
9 * Required
10 * Optional
11
12 ### Defaults
13
14 * No default
15 * Has a non-sub defualt
16 * Has a subroutine default
17
18 ### Slurpy
19
20 * Any type
21 * A specific type -> [Types](#types)
22
23 ## Parameter passing style
24
25 * Named
26 * Named to list
27 * Positional
28
29 ## Types
30
31 ### Type System
32
33 * Moose
34 * Specio
35 * Type::Tiny
36
37 ### Inlining
38
39 * Type can be inlined
40 * Type inlining requires "env" vars
41 * Coercion inlining requires "env" vars
42 * Type cannot be inlined
43
44 ### Coercions
45
46 * No coercion
47 * With coercion(s)
48 * that can all be inlined
49 * none of which can be inlined
50 * some of which can be inlined
77 ignore = t/release-*
88 ignore = t/zzz-*
99 ignore = xt/**/*
10 argv = --profile=$ROOT/perlcriticrc
11
12 [PerlCritic non-auto-generated xt]
13 select = xt/author/matrix.t
1014 argv = --profile=$ROOT/perlcriticrc
1115
1216 [PerlTidy]
2125 ignore = xt/**/*
2226 argv = --profile=$ROOT/perltidyrc
2327
28 [PerlTidy non-auto-generated xt]
29 select = xt/author/matrix.t
30 argv = --profile=$ROOT/perltidyrc
31
2432 [Test::Vars]
2533 select = **/*.pm
2634 ignore = .build/**/*
0 ## no critic (Moose::RequireCleanNamespace)
1 use strict;
2 use warnings;
3
4 use Test2::Bundle::Extended;
5 use Test2::Plugin::NoWarnings;
6 use Test2::Require::Perl '5.012';
7
8 use Hash::Merge qw( merge );
9 use List::AllUtils qw( first_index reduce );
10 use Params::ValidationCompiler qw( validation_for );
11 use Set::Scalar;
12
13 # It'd be nice to add a third parameter and test with three but that ends up
14 # running a ridiculous number of tests.
15 my %foo = _one_param_permutations('foo');
16 my %bar = _one_param_permutations('bar');
17
18 my %slurpy = _slurpy_param_permutations('slurpy');
19
20 OUTER:
21 for my $foo_desc ( sort keys %foo ) {
22 subtest 'one parameter' => sub {
23 my $p = $foo{$foo_desc};
24
25 subtest $foo_desc => sub {
26 subtest 'named params' => sub {
27 _named_params_tests($p);
28 };
29
30 subtest 'positional params' => sub {
31 _positional_params_tests($p);
32 };
33
34 subtest 'named_to_list params' => sub {
35 _named_to_list_params_tests($p);
36 };
37
38 for my $slurpy_desc ( sort keys %slurpy ) {
39 subtest 'slurpy named params' => sub {
40 _named_slurpy_tests( $p, $slurpy{$slurpy_desc} );
41 };
42 subtest 'slurpy positional params' => sub {
43 _positional_slurpy_tests( $p, $slurpy{$slurpy_desc} );
44 };
45 }
46 };
47 } or last OUTER;
48
49 for my $bar_desc ( sort keys %bar ) {
50 subtest 'two parameters' => sub {
51 my @p = ( $foo{$foo_desc}, $bar{$bar_desc} );
52
53 subtest "$foo_desc + $bar_desc" => sub {
54 subtest 'named params' => sub {
55 _named_params_tests(@p);
56 };
57
58 subtest 'positional params' => sub {
59 _positional_params_tests(@p);
60 };
61
62 subtest 'named_to_list params' => sub {
63 _named_to_list_params_tests(@p);
64 };
65 };
66 } or last OUTER;
67 }
68 }
69
70 done_testing();
71
72 sub _named_params_tests {
73 my @p = @_;
74
75 my $named_v;
76 is(
77 dies {
78 $named_v = validation_for(
79 params => { map { $_->{key} => $_->{spec} } @p } );
80 },
81 undef,
82 'no exception compiling named params validator'
83 ) or return;
84
85 _run_param_tests(
86 \@p,
87 'named',
88 sub {
89 my $input = shift;
90 my $output = shift;
91
92 is(
93 { $named_v->( %{$input} ) },
94 $output,
95 'input as k/v pairs'
96 );
97
98 is(
99 { $named_v->($input) },
100 $output,
101 'input as hashref'
102 );
103 },
104 );
105 }
106
107 sub _positional_params_tests {
108 my @p = @_;
109
110 # If this permutation has an optional param before a required param then
111 # we cannot run these tests, as this is not allowed.
112 my $first_o
113 = first_index { $_->{spec}{optional} || exists $_->{spec}{default} }
114 @p;
115 my $first_r = first_index {
116 !( $_->{spec}{optional} || exists $_->{spec}{default} )
117 }
118 @p;
119
120 if ( $first_o >= 0 && $first_o < $first_r ) {
121 SKIP: {
122 skip(
123 'test would end up with optional params before required',
124 1
125 );
126 }
127 return;
128 }
129
130 my $pos_v;
131 is(
132 dies {
133 $pos_v = validation_for( params => [ map { $_->{spec} } @p ] )
134 },
135 undef,
136 'no exception compiling positional params validator'
137 ) or return;
138
139 _run_param_tests(
140 \@p,
141 'pos',
142 sub {
143 my $input = shift;
144 my $output = shift;
145
146 is(
147 [ $pos_v->( @{$input} ) ],
148 $output,
149 'input as list'
150 );
151 },
152 );
153 }
154
155 sub _named_to_list_params_tests {
156 my @p = @_;
157
158 my @sorted_p = sort { $a->{key} cmp $b->{key} } @p;
159
160 my $ntl_v;
161 is(
162 dies {
163 $ntl_v = validation_for(
164 params => [ map { $_->{key} => $_->{spec} } @sorted_p ],
165 named_to_list => 1,
166 );
167 },
168 undef,
169 'no exception compiling positional params validator with named_to_list'
170 ) or return;
171
172 _run_param_tests(
173 \@p,
174 'named',
175 sub {
176 my $input = shift;
177 my $output = shift;
178
179 is(
180 [ $ntl_v->($input) ],
181 [ map { $output->{$_} } map { $_->{key} } @sorted_p ],
182 );
183 },
184 );
185 }
186
187 sub _named_slurpy_tests {
188 my $p = shift;
189 my $slurpy = shift;
190
191 my $slurpy_v;
192 is(
193 dies {
194 $slurpy_v = validation_for(
195 params => { $p->{key} => $p->{spec} },
196 slurpy => ( $slurpy->{spec}{type} || 1 ),
197 );
198 },
199 undef,
200 'no exception compiling named params + slurpy validator'
201 ) or return;
202
203 _run_param_tests(
204 [ $p, $slurpy ],
205 'named',
206 sub {
207 my $input = shift;
208 my $output = shift;
209
210 is(
211 { $slurpy_v->( %{$input} ) },
212 $output,
213 'input as k/v pairs'
214 );
215 },
216 );
217 }
218
219 sub _positional_slurpy_tests {
220 my $p = shift;
221 my $slurpy = shift;
222
223 my $slurpy_v;
224 is(
225 dies {
226 $slurpy_v = validation_for(
227 params => [ $p->{spec} ],
228 slurpy => ( $slurpy->{spec}{type} || 1 ),
229 );
230 },
231 undef,
232 'no exception compiling positional params + slurpy validator'
233 ) or return;
234
235 _run_param_tests(
236 [ $p, $slurpy ],
237 'pos',
238 sub {
239 my $input = shift;
240 my $output = shift;
241
242 is(
243 [ $slurpy_v->( @{$input} ) ],
244 $output,
245 'input as list'
246 );
247 },
248 );
249 }
250
251 sub _run_param_tests {
252 my $p = shift;
253 my $type = shift;
254 my $test_code = shift;
255
256 my @sets
257 = map { Set::Scalar->new( keys %{ $_->{tests} } ) } @{$p};
258
259 my $iter = Set::Scalar->cartesian_product_iterator(@sets);
260 while ( my @test_keys = $iter->() ) {
261 my $subtest = join q{ + }, @test_keys;
262
263 # If we're testing positional params with more than 1 parameter, and
264 # any parameter but the last has an empty input list, then we cannot
265 # run that particular test set. We'd end up with an array built from
266 # [], [42], [{ foo => 1 }] as the list of inputs, which gets turned
267 # into a 2 element array when 3 need to be passed in.
268 if ( $type eq 'pos' && @{$p} > 1 ) {
269 for my $i ( 0 .. $#test_keys - 1 ) {
270 if ( @{ $p->[$i]->{tests}{ $test_keys[$i] }{$type}{input} }
271 == 0 ) {
272 subtest $subtest => sub {
273 SKIP: {
274 skip
275 'Cannot run a test set where any non-last parameter has an empty input list',
276 1;
277 }
278 };
279 return;
280 }
281 }
282 }
283
284 my $in_out = reduce { merge( $a, $b ) }
285 map { $p->[$_]->{tests}{ $test_keys[$_] }{$type} } 0 .. $#test_keys;
286
287 subtest $subtest => sub {
288 $test_code->( $in_out->{input}, $in_out->{output} );
289 };
290 }
291 }
292
293 sub _one_param_permutations {
294 my $key = shift;
295
296 my %types = (
297 'no type' => undef,
298 _one_type_permutations(),
299 );
300
301 my %optional = (
302 required => 0,
303 optional => 1,
304 );
305
306 my %default = (
307 none => undef,
308 'simple scalar' => 42,
309 'subroutine' => sub {42},
310 );
311
312 my %perms;
313
314 for my $t ( sort keys %types ) {
315 for my $o ( sort keys %optional ) {
316 for my $d ( sort keys %default ) {
317 my $desc = "type = $t";
318
319 my %spec;
320 my %tests = (
321 (
322 $t eq 'no type'
323 ? 'any value is accepted'
324 : 'value passes type check'
325 ) => {
326 named => {
327 input => { $key => 700 },
328 output => { $key => 700 },
329 },
330 pos => {
331 input => [700],
332 output => [700],
333 },
334 },
335 );
336
337 if ( $t =~ /coercion/ ) {
338 $tests{'value is coerced'} = {
339 named => {
340 input => { $key => [ 1 .. 4 ] },
341 output => { $key => 4 },
342 },
343 pos => {
344 input => [ [ 1 .. 4 ] ],
345 output => [4],
346 },
347 };
348 }
349
350 if ( $optional{$o} ) {
351 $spec{optional} = 1;
352 $desc .= "; $o";
353
354 $tests{'no value given for optional param'} = {
355 named => {
356 input => {},
357 output => {},
358 },
359 pos => {
360 input => [],
361 output => [],
362 }
363 };
364 }
365 else {
366 $spec{default} = $default{$d} if $default{$d};
367
368 if ( $d eq 'none' ) {
369 $desc .= "; $o; default = $d";
370 }
371 else {
372 $tests{'no value given for param with default'} = {
373 named => {
374 input => {},
375 output => { $key => 42 },
376 },
377 pos => {
378 input => [],
379 output => [42],
380 }
381 };
382
383 $desc .= "; default = $d";
384 }
385 }
386
387 $spec{type} = $types{$t} if $types{$t};
388
389 $perms{$desc} = {
390 key => $key,
391 spec => \%spec,
392 tests => \%tests,
393 };
394 }
395 }
396 }
397
398 return %perms;
399 }
400
401 sub _slurpy_param_permutations {
402 my $key = shift;
403
404 my %types = (
405 'no type' => undef,
406 _one_type_permutations(),
407 );
408
409 my %perms;
410
411 for my $t ( sort keys %types ) {
412 my $desc = "type = $t";
413
414 my %spec;
415 my %tests = (
416 (
417 $t eq 'no type'
418 ? 'any value is accepted'
419 : 'value passes type check'
420 ) => {
421 named => {
422 input => { $key => 700 },
423 output => { $key => 700 },
424 },
425 pos => {
426 input => [700],
427 output => [700],
428 },
429 },
430 );
431
432 if ( $t =~ /coercion/ ) {
433 $tests{'value is coerced'} = {
434 named => {
435 input => { $key => [ 1 .. 4 ] },
436 output => { $key => 4 },
437 },
438 pos => {
439 input => [ [ 1 .. 4 ] ],
440 output => [4],
441 },
442 };
443 }
444
445 $spec{type} = $types{$t} if $types{$t};
446
447 $spec{$desc} = {
448 key => $key,
449 spec => \%spec,
450 tests => \%tests,
451 };
452 }
453
454 return %perms;
455 }
456
457 sub _one_type_permutations {
458 my %subs = (
459 'inlinable type' => 'inl_type',
460 'inlinable type, inlinable coercion' => 'inl_type_with_inl_coercion',
461 'inlinable type, non-inlinable coercion' =>
462 'inl_type_with_no_inl_coercion',
463 'non-inlinable type' => 'no_inl_type',
464 'non-inlinable type, inlinable coercion' =>
465 'no_inl_type_with_inl_coercion',
466 'non-inlinable type, non-inlinable coercion' =>
467 'no_inl_type_with_no_inl_coercion',
468 'inlinable type with closed-over variables' => 'closure_inl_env_type',
469 );
470
471 my %perms;
472
473 for my $flavor (qw( Moose TT Specio )) {
474 my $pkg = '_Types::' . $flavor;
475
476 for my $k ( sort keys %subs ) {
477 my $s = $subs{$k};
478 next unless $pkg->can($s);
479
480 $perms{"$flavor - $k"} = $pkg->$s();
481 }
482 }
483
484 return %perms;
485 }
486
487 ## no critic (Modules::ProhibitMultiplePackages)
488
489 {
490 package _Types::Moose;
491
492 use Moose::Util::TypeConstraints;
493
494 ## no critic (Subroutines::ProtectPrivateSubs)
495
496 sub inl_type {
497 my $type = subtype(
498 as 'Int',
499 where { $_ > 0 },
500 inline_as {
501 $_[0]->parent->_inline_check( $_[1] ) . " && $_[1] > 0"
502 },
503 );
504
505 return $type;
506 }
507
508 sub inl_type_with_no_inl_coercion {
509 my $type = subtype(
510 as 'Int',
511 where { $_ > 0 },
512 inline_as {
513 $_[0]->parent->_inline_check( $_[1] ) . " && $_[1] > 0"
514 },
515 );
516
517 coerce(
518 $type,
519 from 'ArrayRef',
520 via { scalar @{$_} },
521 );
522
523 return $type;
524 }
525
526 sub no_inl_type {
527 my $type = subtype(
528 as 'Int',
529 where { $_ > 0 },
530 );
531
532 return $type;
533 }
534
535 sub no_inl_type_with_no_inl_coercion {
536 my $type = subtype(
537 as 'Int',
538 where { $_ > 0 },
539 );
540
541 coerce(
542 $type,
543 from 'ArrayRef',
544 via { scalar @{$_} },
545 );
546
547 return $type;
548 }
549
550 sub closure_inl_env_type {
551 return enum( [ 42, 43, 44, 700 ] );
552 }
553 }
554
555 {
556 package _Types::TT;
557
558 use Types::Standard qw( Int ArrayRef );
559 use Type::Utils -all;
560
561 sub inl_type {
562 my $type = subtype(
563 as Int,
564 where { $_ > 0 },
565 inline_as {
566 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0"
567 },
568 );
569
570 return $type;
571 }
572
573 sub inl_type_with_inl_coercion {
574 my $type = subtype(
575 as Int,
576 where { $_ > 0 },
577 inline_as {
578 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0"
579 },
580 );
581
582 return $type->plus_coercions( ArrayRef, 'scalar @{ $_ }' );
583 }
584
585 sub inl_type_with_no_inl_coercion {
586 my $type = subtype(
587 as Int,
588 where { $_ > 0 },
589 inline_as {
590 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0"
591 },
592 );
593
594 return $type->plus_coercions( ArrayRef, sub { scalar @{$_} } );
595 }
596
597 sub no_inl_type {
598 my $type = subtype(
599 as Int,
600 where { $_ > 0 }
601 );
602
603 return $type;
604 }
605
606 sub no_inl_type_with_inl_coercion {
607 my $type = subtype(
608 as Int,
609 where { $_ > 0 }
610 );
611
612 return $type->plus_coercions( ArrayRef, 'scalar @{ $_ }' );
613 }
614
615 sub no_inl_type_with_no_inl_coercion {
616 my $type = subtype(
617 as Int,
618 where { $_ > 0 }
619 );
620
621 return $type->plus_coercions( ArrayRef, sub { scalar @{$_} } );
622 }
623 }
624
625 {
626 package _Types::Specio;
627
628 use Specio::Declare;
629 use Specio::Library::Builtins;
630
631 sub inl_type {
632 my $type = anon(
633 parent => t('Int'),
634 inline => sub {
635 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0";
636 },
637 );
638
639 return $type;
640 }
641
642 sub inl_type_with_inl_coercion {
643 my $type = anon(
644 parent => t('Int'),
645 inline => sub {
646 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0";
647 },
648 );
649
650 coerce(
651 $type,
652 from => t('ArrayRef'),
653 inline => sub {"scalar \@{ $_[1] }"},
654 );
655
656 return $type;
657 }
658
659 sub inl_type_with_no_inl_coercion {
660 my $type = anon(
661 parent => t('Int'),
662 inline => sub {
663 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0";
664 },
665 );
666
667 coerce(
668 $type,
669 from => t('ArrayRef'),
670 using => sub { scalar @{ $_[0] } },
671 );
672
673 return $type;
674 }
675
676 sub no_inl_type {
677 my $type = anon(
678 parent => t('Int'),
679 inline => sub {
680 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0";
681 },
682 );
683
684 return $type;
685 }
686
687 sub no_inl_type_with_inl_coercion {
688 my $type = anon(
689 parent => t('Int'),
690 inline => sub {
691 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0";
692 },
693 );
694
695 coerce(
696 $type,
697 from => t('ArrayRef'),
698 inline => sub {"scalar \@{ $_[1] }"},
699 );
700
701 return $type;
702 }
703
704 sub no_inl_type_with_no_inl_coercion {
705 my $type = anon(
706 parent => t('Int'),
707 inline => sub {
708 $_[0]->parent->inline_check( $_[1] ) . " && $_[1] > 0";
709 },
710 );
711
712 coerce(
713 $type,
714 from => t('ArrayRef'),
715 using => sub { scalar @{ $_[0] } },
716 );
717
718 return $type;
719 }
720
721 sub closure_inl_env_type {
722 return enum( values => [ 42, 43, 44, 700 ] );
723 }
724 }
725
726 __END__
727
728 ## Parameter specs
729
730 ### Type
731
732 * No type, just required
733 * Has a type -> [Types](#types)
734
735 ### Required or not
736
737 * Required
738 * Optional
739
740 ### Defaults
741
742 * No default
743 * Has a non-sub default
744 * Has a subroutine default
745
746 ## Slurpy
747
748 * Any type
749 * A specific type -> [Types](#types)
750
751 ## Parameter passing style
752
753 * Named
754 * As k/v pairs
755 * As hashref
756 * Named to list
757 * Positional
758
759 ## Types
760
761 ### Type System
762
763 * Moose
764 * Specio
765 * Type::Tiny
766
767 ### Inlining
768
769 * Type can be inlined
770 * Type inlining requires "env" vars
771 * Coercion inlining requires "env" vars
772 * Type cannot be inlined
773
774 ### Coercions
775
776 * No coercion
777 * With coercion(s)
778 * that can all be inlined
779 * none of which can be inlined
780 * some of which can be inlined