Merge tag 'upstream/0.23'
Upstream version 0.23
Nick Morrott
7 years ago
127 | 127 | request to the .mailmap file to contain the correct mapping. |
128 | 128 | |
129 | 129 | 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 | ||
0 | 9 | 0.22 2016-12-31 |
1 | 10 | |
2 | 11 | - 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. | |
1 | 1 | |
2 | 2 | This is free software, licensed under: |
3 | 3 |
35 | 35 | t/specio.t |
36 | 36 | t/type-tiny.t |
37 | 37 | test-matrix.als |
38 | test-matrix.md | |
39 | 38 | tidyall.ini |
40 | 39 | xt/author/00-compile.t |
41 | 40 | xt/author/eol.t |
41 | xt/author/matrix.t | |
42 | 42 | xt/author/mojibake.t |
43 | 43 | xt/author/no-tabs.t |
44 | 44 | xt/author/pod-coverage.t |
23 | 23 | "Code::TidyAll::Plugin::Test::Vars" : "0.02", |
24 | 24 | "Const::Fast" : "0.014", |
25 | 25 | "File::Spec" : "0", |
26 | "Hash::Merge" : "0", | |
26 | 27 | "Hash::Util" : "0", |
27 | 28 | "IO::Handle" : "0", |
28 | 29 | "IPC::Open3" : "0", |
30 | "List::AllUtils" : "0", | |
29 | 31 | "Moose" : "2.0000", |
30 | 32 | "Parallel::ForkManager" : "1.19", |
31 | 33 | "Perl::Critic" : "1.126", |
32 | 34 | "Perl::Tidy" : "20160302", |
33 | 35 | "Pod::Coverage::TrustPod" : "0", |
34 | 36 | "Pod::Wordlist" : "0", |
37 | "Set::Scalar" : "0", | |
35 | 38 | "Specio" : "0.14", |
36 | 39 | "Sub::Util" : "1.40", |
40 | "Test2::Bundle::Extended" : "0", | |
41 | "Test2::Plugin::NoWarnings" : "0", | |
42 | "Test2::Require::Perl" : "0", | |
37 | 43 | "Test::CPAN::Changes" : "0.19", |
38 | 44 | "Test::CPAN::Meta::JSON" : "0.16", |
39 | 45 | "Test::Code::TidyAll" : "0.50", |
49 | 55 | "Test::Vars" : "0.009", |
50 | 56 | "Test::Version" : "2.05", |
51 | 57 | "Type::Tiny" : "0", |
58 | "Type::Utils" : "0", | |
52 | 59 | "blib" : "1.01", |
53 | 60 | "perl" : "5.006" |
54 | 61 | } |
90 | 97 | "provides" : { |
91 | 98 | "Params::ValidationCompiler" : { |
92 | 99 | "file" : "lib/Params/ValidationCompiler.pm", |
93 | "version" : "0.22" | |
100 | "version" : "0.23" | |
94 | 101 | }, |
95 | 102 | "Params::ValidationCompiler::Compiler" : { |
96 | 103 | "file" : "lib/Params/ValidationCompiler/Compiler.pm", |
97 | "version" : "0.22" | |
104 | "version" : "0.23" | |
98 | 105 | }, |
99 | 106 | "Params::ValidationCompiler::Exceptions" : { |
100 | 107 | "file" : "lib/Params/ValidationCompiler/Exceptions.pm", |
101 | "version" : "0.22" | |
108 | "version" : "0.23" | |
102 | 109 | } |
103 | 110 | }, |
104 | 111 | "release_status" : "stable", |
113 | 120 | "web" : "https://github.com/houseabsolute/Params-ValidationCompiler" |
114 | 121 | } |
115 | 122 | }, |
116 | "version" : 0.22, | |
123 | "version" : "0.23", | |
117 | 124 | "x_Dist_Zilla" : { |
118 | 125 | "perl" : { |
119 | 126 | "version" : "5.024000" |
200 | 207 | "version" : "6.008" |
201 | 208 | }, |
202 | 209 | { |
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" | |
206 | 213 | }, |
207 | 214 | { |
208 | 215 | "class" : "Dist::Zilla::Plugin::Authority", |
259 | 266 | "meta_noindex" : 1 |
260 | 267 | }, |
261 | 268 | "Dist::Zilla::Role::ModuleMetadata" : { |
262 | "Module::Metadata" : "1.000033", | |
269 | "Module::Metadata" : "1.000031", | |
263 | 270 | "version" : "0.003" |
264 | 271 | } |
265 | 272 | }, |
351 | 358 | "phase" : "release", |
352 | 359 | "run_under_travis" : 0, |
353 | 360 | "skip" : [ |
354 | "Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent", | |
355 | 361 | "Dist::Zilla::Plugin::DROLSKY::Contributors", |
356 | 362 | "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", |
357 | 363 | "Dist::Zilla::Plugin::DROLSKY::License", |
358 | 364 | "Dist::Zilla::Plugin::DROLSKY::TidyAll", |
359 | "Dist::Zilla::Plugin::DROLSKY::VersionProvider", | |
360 | 365 | "Pod::Weaver::PluginBundle::DROLSKY" |
361 | 366 | ] |
362 | 367 | } |
519 | 524 | { |
520 | 525 | "class" : "Dist::Zilla::Plugin::DROLSKY::Contributors", |
521 | 526 | "name" : "@DROLSKY/DROLSKY::Contributors", |
522 | "version" : "0.78" | |
527 | "version" : "0.80" | |
523 | 528 | }, |
524 | 529 | { |
525 | 530 | "class" : "Dist::Zilla::Plugin::Git::Contributors", |
526 | 531 | "config" : { |
527 | 532 | "Dist::Zilla::Plugin::Git::Contributors" : { |
528 | "git --version" : "2.11.0", | |
533 | "git --version" : "2.7.4", | |
529 | 534 | "include_authors" : 0, |
530 | 535 | "include_releaser" : 1, |
531 | 536 | "order_by" : "name", |
550 | 555 | { |
551 | 556 | "class" : "Pod::Weaver::Plugin::EnsurePod5", |
552 | 557 | "name" : "@CorePrep/EnsurePod5", |
553 | "version" : "4.015" | |
558 | "version" : "4.013" | |
554 | 559 | }, |
555 | 560 | { |
556 | 561 | "class" : "Pod::Weaver::Plugin::H1Nester", |
557 | 562 | "name" : "@CorePrep/H1Nester", |
558 | "version" : "4.015" | |
563 | "version" : "4.013" | |
559 | 564 | }, |
560 | 565 | { |
561 | 566 | "class" : "Pod::Weaver::Plugin::SingleEncoding", |
562 | 567 | "name" : "@DROLSKY/SingleEncoding", |
563 | "version" : "4.015" | |
568 | "version" : "4.013" | |
564 | 569 | }, |
565 | 570 | { |
566 | 571 | "class" : "Pod::Weaver::Plugin::Transformer", |
567 | 572 | "name" : "@DROLSKY/List", |
568 | "version" : "4.015" | |
573 | "version" : "4.013" | |
569 | 574 | }, |
570 | 575 | { |
571 | 576 | "class" : "Pod::Weaver::Plugin::Transformer", |
572 | 577 | "name" : "@DROLSKY/Verbatim", |
573 | "version" : "4.015" | |
578 | "version" : "4.013" | |
574 | 579 | }, |
575 | 580 | { |
576 | 581 | "class" : "Pod::Weaver::Section::Region", |
577 | 582 | "name" : "@DROLSKY/header", |
578 | "version" : "4.015" | |
583 | "version" : "4.013" | |
579 | 584 | }, |
580 | 585 | { |
581 | 586 | "class" : "Pod::Weaver::Section::Name", |
582 | 587 | "name" : "@DROLSKY/Name", |
583 | "version" : "4.015" | |
588 | "version" : "4.013" | |
584 | 589 | }, |
585 | 590 | { |
586 | 591 | "class" : "Pod::Weaver::Section::Version", |
587 | 592 | "name" : "@DROLSKY/Version", |
588 | "version" : "4.015" | |
593 | "version" : "4.013" | |
589 | 594 | }, |
590 | 595 | { |
591 | 596 | "class" : "Pod::Weaver::Section::Region", |
592 | 597 | "name" : "@DROLSKY/prelude", |
593 | "version" : "4.015" | |
598 | "version" : "4.013" | |
594 | 599 | }, |
595 | 600 | { |
596 | 601 | "class" : "Pod::Weaver::Section::Generic", |
597 | 602 | "name" : "SYNOPSIS", |
598 | "version" : "4.015" | |
603 | "version" : "4.013" | |
599 | 604 | }, |
600 | 605 | { |
601 | 606 | "class" : "Pod::Weaver::Section::Generic", |
602 | 607 | "name" : "DESCRIPTION", |
603 | "version" : "4.015" | |
608 | "version" : "4.013" | |
604 | 609 | }, |
605 | 610 | { |
606 | 611 | "class" : "Pod::Weaver::Section::Generic", |
607 | 612 | "name" : "OVERVIEW", |
608 | "version" : "4.015" | |
613 | "version" : "4.013" | |
609 | 614 | }, |
610 | 615 | { |
611 | 616 | "class" : "Pod::Weaver::Section::Collect", |
612 | 617 | "name" : "ATTRIBUTES", |
613 | "version" : "4.015" | |
618 | "version" : "4.013" | |
614 | 619 | }, |
615 | 620 | { |
616 | 621 | "class" : "Pod::Weaver::Section::Collect", |
617 | 622 | "name" : "METHODS", |
618 | "version" : "4.015" | |
623 | "version" : "4.013" | |
619 | 624 | }, |
620 | 625 | { |
621 | 626 | "class" : "Pod::Weaver::Section::Collect", |
622 | 627 | "name" : "FUNCTIONS", |
623 | "version" : "4.015" | |
628 | "version" : "4.013" | |
624 | 629 | }, |
625 | 630 | { |
626 | 631 | "class" : "Pod::Weaver::Section::Collect", |
627 | 632 | "name" : "TYPES", |
628 | "version" : "4.015" | |
633 | "version" : "4.013" | |
629 | 634 | }, |
630 | 635 | { |
631 | 636 | "class" : "Pod::Weaver::Section::Leftovers", |
632 | 637 | "name" : "@DROLSKY/Leftovers", |
633 | "version" : "4.015" | |
638 | "version" : "4.013" | |
634 | 639 | }, |
635 | 640 | { |
636 | 641 | "class" : "Pod::Weaver::Section::Region", |
637 | 642 | "name" : "@DROLSKY/postlude", |
638 | "version" : "4.015" | |
643 | "version" : "4.013" | |
639 | 644 | }, |
640 | 645 | { |
641 | 646 | "class" : "Pod::Weaver::Section::GenerateSection", |
642 | 647 | "name" : "@DROLSKY/generate SUPPORT", |
643 | "version" : "1.02" | |
648 | "version" : "1.01" | |
644 | 649 | }, |
645 | 650 | { |
646 | 651 | "class" : "Pod::Weaver::Section::AllowOverride", |
649 | 654 | }, |
650 | 655 | { |
651 | 656 | "class" : "Pod::Weaver::Section::GenerateSection", |
657 | "name" : "@DROLSKY/generate SOURCE", | |
658 | "version" : "1.01" | |
659 | }, | |
660 | { | |
661 | "class" : "Pod::Weaver::Section::GenerateSection", | |
652 | 662 | "name" : "@DROLSKY/generate DONATIONS", |
653 | "version" : "1.02" | |
663 | "version" : "1.01" | |
654 | 664 | }, |
655 | 665 | { |
656 | 666 | "class" : "Pod::Weaver::Section::Authors", |
657 | 667 | "name" : "@DROLSKY/Authors", |
658 | "version" : "4.015" | |
668 | "version" : "4.013" | |
659 | 669 | }, |
660 | 670 | { |
661 | 671 | "class" : "Pod::Weaver::Section::Contributors", |
665 | 675 | { |
666 | 676 | "class" : "Pod::Weaver::Section::Legal", |
667 | 677 | "name" : "@DROLSKY/Legal", |
668 | "version" : "4.015" | |
678 | "version" : "4.013" | |
669 | 679 | }, |
670 | 680 | { |
671 | 681 | "class" : "Pod::Weaver::Section::Region", |
672 | 682 | "name" : "@DROLSKY/footer", |
673 | "version" : "4.015" | |
683 | "version" : "4.013" | |
674 | 684 | } |
675 | 685 | ] |
676 | 686 | } |
681 | 691 | { |
682 | 692 | "class" : "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", |
683 | 693 | "name" : "@DROLSKY/DROLSKY::WeaverConfig", |
684 | "version" : "0.78" | |
694 | "version" : "0.80" | |
685 | 695 | }, |
686 | 696 | { |
687 | 697 | "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", |
726 | 736 | { |
727 | 737 | "class" : "Dist::Zilla::Plugin::DROLSKY::License", |
728 | 738 | "name" : "@DROLSKY/DROLSKY::License", |
729 | "version" : "0.78" | |
739 | "version" : "0.80" | |
730 | 740 | }, |
731 | 741 | { |
732 | 742 | "class" : "Dist::Zilla::Plugin::CheckStrictVersion", |
742 | 752 | ] |
743 | 753 | }, |
744 | 754 | "Dist::Zilla::Role::ModuleMetadata" : { |
745 | "Module::Metadata" : "1.000033", | |
755 | "Module::Metadata" : "1.000031", | |
746 | 756 | "version" : "0.003" |
747 | 757 | } |
748 | 758 | }, |
755 | 765 | "version" : "0.020" |
756 | 766 | }, |
757 | 767 | { |
758 | "class" : "Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent", | |
759 | "name" : "@DROLSKY/DROLSKY::CheckChangesHasContent", | |
760 | "version" : "0.78" | |
761 | }, | |
762 | { | |
763 | 768 | "class" : "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", |
764 | 769 | "config" : { |
765 | 770 | "Dist::Zilla::Role::Git::Repo" : { |
766 | "git --version" : "2.11.0", | |
771 | "git --version" : "2.7.4", | |
767 | 772 | "repo_root" : "." |
768 | 773 | } |
769 | 774 | }, |
770 | 775 | "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" | |
772 | 782 | }, |
773 | 783 | { |
774 | 784 | "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", |
775 | 785 | "config" : { |
776 | 786 | "Dist::Zilla::Role::Git::Repo" : { |
777 | "git --version" : "2.11.0", | |
787 | "git --version" : "2.7.4", | |
778 | 788 | "repo_root" : "." |
779 | 789 | } |
780 | 790 | }, |
784 | 794 | { |
785 | 795 | "class" : "Dist::Zilla::Plugin::DROLSKY::TidyAll", |
786 | 796 | "name" : "@DROLSKY/DROLSKY::TidyAll", |
787 | "version" : "0.78" | |
797 | "version" : "0.80" | |
788 | 798 | }, |
789 | 799 | { |
790 | 800 | "class" : "Dist::Zilla::Plugin::Git::Check", |
806 | 816 | "changelog" : "Changes" |
807 | 817 | }, |
808 | 818 | "Dist::Zilla::Role::Git::Repo" : { |
809 | "git --version" : "2.11.0", | |
819 | "git --version" : "2.7.4", | |
810 | 820 | "repo_root" : "." |
811 | 821 | } |
812 | 822 | }, |
834 | 844 | "changelog" : "Changes" |
835 | 845 | }, |
836 | 846 | "Dist::Zilla::Role::Git::Repo" : { |
837 | "git --version" : "2.11.0", | |
847 | "git --version" : "2.7.4", | |
838 | 848 | "repo_root" : "." |
839 | 849 | }, |
840 | 850 | "Dist::Zilla::Role::Git::StringFormatter" : { |
851 | 861 | "branch" : null, |
852 | 862 | "changelog" : "Changes", |
853 | 863 | "signed" : 0, |
854 | "tag" : "v0.22", | |
864 | "tag" : "v0.23", | |
855 | 865 | "tag_format" : "v%v", |
856 | 866 | "tag_message" : "v%v" |
857 | 867 | }, |
858 | 868 | "Dist::Zilla::Role::Git::Repo" : { |
859 | "git --version" : "2.11.0", | |
869 | "git --version" : "2.7.4", | |
860 | 870 | "repo_root" : "." |
861 | 871 | }, |
862 | 872 | "Dist::Zilla::Role::Git::StringFormatter" : { |
876 | 886 | "remotes_must_exist" : 1 |
877 | 887 | }, |
878 | 888 | "Dist::Zilla::Role::Git::Repo" : { |
879 | "git --version" : "2.11.0", | |
889 | "git --version" : "2.7.4", | |
880 | 890 | "repo_root" : "." |
881 | 891 | } |
882 | 892 | }, |
916 | 926 | "changelog" : "Changes" |
917 | 927 | }, |
918 | 928 | "Dist::Zilla::Role::Git::Repo" : { |
919 | "git --version" : "2.11.0", | |
929 | "git --version" : "2.7.4", | |
920 | 930 | "repo_root" : "." |
921 | 931 | }, |
922 | 932 | "Dist::Zilla::Role::Git::StringFormatter" : { |
936 | 946 | "remotes_must_exist" : 1 |
937 | 947 | }, |
938 | 948 | "Dist::Zilla::Role::Git::Repo" : { |
939 | "git --version" : "2.11.0", | |
949 | "git --version" : "2.7.4", | |
940 | 950 | "repo_root" : "." |
941 | 951 | } |
942 | 952 | }, |
1045 | 1055 | "Gregory Oschwald <goschwald@maxmind.com>", |
1046 | 1056 | "Tomasz Konojacki <me@xenu.pl>" |
1047 | 1057 | ], |
1048 | "x_serialization_backend" : "Cpanel::JSON::XS version 3.0225" | |
1058 | "x_serialization_backend" : "Cpanel::JSON::XS version 3.0213" | |
1049 | 1059 | } |
1050 | 1060 |
23 | 23 | provides: |
24 | 24 | Params::ValidationCompiler: |
25 | 25 | file: lib/Params/ValidationCompiler.pm |
26 | version: '0.22' | |
26 | version: '0.23' | |
27 | 27 | Params::ValidationCompiler::Compiler: |
28 | 28 | file: lib/Params/ValidationCompiler/Compiler.pm |
29 | version: '0.22' | |
29 | version: '0.23' | |
30 | 30 | Params::ValidationCompiler::Exceptions: |
31 | 31 | file: lib/Params/ValidationCompiler/Exceptions.pm |
32 | version: '0.22' | |
32 | version: '0.23' | |
33 | 33 | recommends: |
34 | 34 | Sub::Util: '1.40' |
35 | 35 | requires: |
47 | 47 | bugtracker: https://github.com/houseabsolute/Params-ValidationCompiler/issues |
48 | 48 | homepage: http://metacpan.org/release/Params-ValidationCompiler |
49 | 49 | repository: git://github.com/houseabsolute/Params-ValidationCompiler.git |
50 | version: '0.22' | |
50 | version: '0.23' | |
51 | 51 | x_Dist_Zilla: |
52 | 52 | perl: |
53 | 53 | version: '5.024000' |
116 | 116 | name: '@DROLSKY/UploadToCPAN' |
117 | 117 | version: '6.008' |
118 | 118 | - |
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' | |
122 | 122 | - |
123 | 123 | class: Dist::Zilla::Plugin::Authority |
124 | 124 | name: '@DROLSKY/Authority' |
162 | 162 | inherit_version: '1' |
163 | 163 | meta_noindex: '1' |
164 | 164 | Dist::Zilla::Role::ModuleMetadata: |
165 | Module::Metadata: '1.000033' | |
165 | Module::Metadata: '1.000031' | |
166 | 166 | version: '0.003' |
167 | 167 | name: '@DROLSKY/MetaProvides::Package' |
168 | 168 | version: '2.004002' |
233 | 233 | phase: release |
234 | 234 | run_under_travis: 0 |
235 | 235 | skip: |
236 | - Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent | |
237 | 236 | - Dist::Zilla::Plugin::DROLSKY::Contributors |
238 | 237 | - Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch |
239 | 238 | - Dist::Zilla::Plugin::DROLSKY::License |
240 | 239 | - Dist::Zilla::Plugin::DROLSKY::TidyAll |
241 | - Dist::Zilla::Plugin::DROLSKY::VersionProvider | |
242 | 240 | - Pod::Weaver::PluginBundle::DROLSKY |
243 | 241 | name: '@DROLSKY/PromptIfStale' |
244 | 242 | version: '0.051' |
362 | 360 | - |
363 | 361 | class: Dist::Zilla::Plugin::DROLSKY::Contributors |
364 | 362 | name: '@DROLSKY/DROLSKY::Contributors' |
365 | version: '0.78' | |
363 | version: '0.80' | |
366 | 364 | - |
367 | 365 | class: Dist::Zilla::Plugin::Git::Contributors |
368 | 366 | config: |
369 | 367 | Dist::Zilla::Plugin::Git::Contributors: |
370 | 'git --version': 2.11.0 | |
368 | 'git --version': 2.7.4 | |
371 | 369 | include_authors: 0 |
372 | 370 | include_releaser: 1 |
373 | 371 | order_by: name |
387 | 385 | - |
388 | 386 | class: Pod::Weaver::Plugin::EnsurePod5 |
389 | 387 | name: '@CorePrep/EnsurePod5' |
390 | version: '4.015' | |
388 | version: '4.013' | |
391 | 389 | - |
392 | 390 | class: Pod::Weaver::Plugin::H1Nester |
393 | 391 | name: '@CorePrep/H1Nester' |
394 | version: '4.015' | |
392 | version: '4.013' | |
395 | 393 | - |
396 | 394 | class: Pod::Weaver::Plugin::SingleEncoding |
397 | 395 | name: '@DROLSKY/SingleEncoding' |
398 | version: '4.015' | |
396 | version: '4.013' | |
399 | 397 | - |
400 | 398 | class: Pod::Weaver::Plugin::Transformer |
401 | 399 | name: '@DROLSKY/List' |
402 | version: '4.015' | |
400 | version: '4.013' | |
403 | 401 | - |
404 | 402 | class: Pod::Weaver::Plugin::Transformer |
405 | 403 | name: '@DROLSKY/Verbatim' |
406 | version: '4.015' | |
404 | version: '4.013' | |
407 | 405 | - |
408 | 406 | class: Pod::Weaver::Section::Region |
409 | 407 | name: '@DROLSKY/header' |
410 | version: '4.015' | |
408 | version: '4.013' | |
411 | 409 | - |
412 | 410 | class: Pod::Weaver::Section::Name |
413 | 411 | name: '@DROLSKY/Name' |
414 | version: '4.015' | |
412 | version: '4.013' | |
415 | 413 | - |
416 | 414 | class: Pod::Weaver::Section::Version |
417 | 415 | name: '@DROLSKY/Version' |
418 | version: '4.015' | |
416 | version: '4.013' | |
419 | 417 | - |
420 | 418 | class: Pod::Weaver::Section::Region |
421 | 419 | name: '@DROLSKY/prelude' |
422 | version: '4.015' | |
420 | version: '4.013' | |
423 | 421 | - |
424 | 422 | class: Pod::Weaver::Section::Generic |
425 | 423 | name: SYNOPSIS |
426 | version: '4.015' | |
424 | version: '4.013' | |
427 | 425 | - |
428 | 426 | class: Pod::Weaver::Section::Generic |
429 | 427 | name: DESCRIPTION |
430 | version: '4.015' | |
428 | version: '4.013' | |
431 | 429 | - |
432 | 430 | class: Pod::Weaver::Section::Generic |
433 | 431 | name: OVERVIEW |
434 | version: '4.015' | |
432 | version: '4.013' | |
435 | 433 | - |
436 | 434 | class: Pod::Weaver::Section::Collect |
437 | 435 | name: ATTRIBUTES |
438 | version: '4.015' | |
436 | version: '4.013' | |
439 | 437 | - |
440 | 438 | class: Pod::Weaver::Section::Collect |
441 | 439 | name: METHODS |
442 | version: '4.015' | |
440 | version: '4.013' | |
443 | 441 | - |
444 | 442 | class: Pod::Weaver::Section::Collect |
445 | 443 | name: FUNCTIONS |
446 | version: '4.015' | |
444 | version: '4.013' | |
447 | 445 | - |
448 | 446 | class: Pod::Weaver::Section::Collect |
449 | 447 | name: TYPES |
450 | version: '4.015' | |
448 | version: '4.013' | |
451 | 449 | - |
452 | 450 | class: Pod::Weaver::Section::Leftovers |
453 | 451 | name: '@DROLSKY/Leftovers' |
454 | version: '4.015' | |
452 | version: '4.013' | |
455 | 453 | - |
456 | 454 | class: Pod::Weaver::Section::Region |
457 | 455 | name: '@DROLSKY/postlude' |
458 | version: '4.015' | |
456 | version: '4.013' | |
459 | 457 | - |
460 | 458 | class: Pod::Weaver::Section::GenerateSection |
461 | 459 | name: '@DROLSKY/generate SUPPORT' |
462 | version: '1.02' | |
460 | version: '1.01' | |
463 | 461 | - |
464 | 462 | class: Pod::Weaver::Section::AllowOverride |
465 | 463 | name: '@DROLSKY/allow override SUPPORT' |
466 | 464 | version: '0.05' |
467 | 465 | - |
468 | 466 | class: Pod::Weaver::Section::GenerateSection |
467 | name: '@DROLSKY/generate SOURCE' | |
468 | version: '1.01' | |
469 | - | |
470 | class: Pod::Weaver::Section::GenerateSection | |
469 | 471 | name: '@DROLSKY/generate DONATIONS' |
470 | version: '1.02' | |
472 | version: '1.01' | |
471 | 473 | - |
472 | 474 | class: Pod::Weaver::Section::Authors |
473 | 475 | name: '@DROLSKY/Authors' |
474 | version: '4.015' | |
476 | version: '4.013' | |
475 | 477 | - |
476 | 478 | class: Pod::Weaver::Section::Contributors |
477 | 479 | name: '@DROLSKY/Contributors' |
479 | 481 | - |
480 | 482 | class: Pod::Weaver::Section::Legal |
481 | 483 | name: '@DROLSKY/Legal' |
482 | version: '4.015' | |
484 | version: '4.013' | |
483 | 485 | - |
484 | 486 | class: Pod::Weaver::Section::Region |
485 | 487 | name: '@DROLSKY/footer' |
486 | version: '4.015' | |
488 | version: '4.013' | |
487 | 489 | name: '@DROLSKY/SurgicalPodWeaver' |
488 | 490 | version: '0.0023' |
489 | 491 | - |
490 | 492 | class: Dist::Zilla::Plugin::DROLSKY::WeaverConfig |
491 | 493 | name: '@DROLSKY/DROLSKY::WeaverConfig' |
492 | version: '0.78' | |
494 | version: '0.80' | |
493 | 495 | - |
494 | 496 | class: Dist::Zilla::Plugin::ReadmeAnyFromPod |
495 | 497 | config: |
524 | 526 | - |
525 | 527 | class: Dist::Zilla::Plugin::DROLSKY::License |
526 | 528 | name: '@DROLSKY/DROLSKY::License' |
527 | version: '0.78' | |
529 | version: '0.80' | |
528 | 530 | - |
529 | 531 | class: Dist::Zilla::Plugin::CheckStrictVersion |
530 | 532 | name: '@DROLSKY/CheckStrictVersion' |
536 | 538 | finder: |
537 | 539 | - ':InstallModules' |
538 | 540 | Dist::Zilla::Role::ModuleMetadata: |
539 | Module::Metadata: '1.000033' | |
541 | Module::Metadata: '1.000031' | |
540 | 542 | version: '0.003' |
541 | 543 | name: '@DROLSKY/CheckSelfDependency' |
542 | 544 | version: '0.011' |
545 | 547 | name: '@DROLSKY/CheckPrereqsIndexed' |
546 | 548 | version: '0.020' |
547 | 549 | - |
548 | class: Dist::Zilla::Plugin::DROLSKY::CheckChangesHasContent | |
549 | name: '@DROLSKY/DROLSKY::CheckChangesHasContent' | |
550 | version: '0.78' | |
551 | - | |
552 | 550 | class: Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch |
553 | 551 | config: |
554 | 552 | Dist::Zilla::Role::Git::Repo: |
555 | 'git --version': 2.11.0 | |
553 | 'git --version': 2.7.4 | |
556 | 554 | repo_root: . |
557 | 555 | 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' | |
559 | 561 | - |
560 | 562 | class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts |
561 | 563 | config: |
562 | 564 | Dist::Zilla::Role::Git::Repo: |
563 | 'git --version': 2.11.0 | |
565 | 'git --version': 2.7.4 | |
564 | 566 | repo_root: . |
565 | 567 | name: '@DROLSKY/Git::CheckFor::MergeConflicts' |
566 | 568 | version: '0.014' |
567 | 569 | - |
568 | 570 | class: Dist::Zilla::Plugin::DROLSKY::TidyAll |
569 | 571 | name: '@DROLSKY/DROLSKY::TidyAll' |
570 | version: '0.78' | |
572 | version: '0.80' | |
571 | 573 | - |
572 | 574 | class: Dist::Zilla::Plugin::Git::Check |
573 | 575 | config: |
585 | 587 | allow_dirty_match: [] |
586 | 588 | changelog: Changes |
587 | 589 | Dist::Zilla::Role::Git::Repo: |
588 | 'git --version': 2.11.0 | |
590 | 'git --version': 2.7.4 | |
589 | 591 | repo_root: . |
590 | 592 | name: '@DROLSKY/Git::Check' |
591 | 593 | version: '2.041' |
607 | 609 | allow_dirty_match: [] |
608 | 610 | changelog: Changes |
609 | 611 | Dist::Zilla::Role::Git::Repo: |
610 | 'git --version': 2.11.0 | |
612 | 'git --version': 2.7.4 | |
611 | 613 | repo_root: . |
612 | 614 | Dist::Zilla::Role::Git::StringFormatter: |
613 | 615 | time_zone: local |
620 | 622 | branch: ~ |
621 | 623 | changelog: Changes |
622 | 624 | signed: 0 |
623 | tag: v0.22 | |
625 | tag: v0.23 | |
624 | 626 | tag_format: v%v |
625 | 627 | tag_message: v%v |
626 | 628 | Dist::Zilla::Role::Git::Repo: |
627 | 'git --version': 2.11.0 | |
629 | 'git --version': 2.7.4 | |
628 | 630 | repo_root: . |
629 | 631 | Dist::Zilla::Role::Git::StringFormatter: |
630 | 632 | time_zone: local |
638 | 640 | - origin |
639 | 641 | remotes_must_exist: 1 |
640 | 642 | Dist::Zilla::Role::Git::Repo: |
641 | 'git --version': 2.11.0 | |
643 | 'git --version': 2.7.4 | |
642 | 644 | repo_root: . |
643 | 645 | name: '@DROLSKY/Git::Push' |
644 | 646 | version: '2.041' |
667 | 669 | - (?^:.+) |
668 | 670 | changelog: Changes |
669 | 671 | Dist::Zilla::Role::Git::Repo: |
670 | 'git --version': 2.11.0 | |
672 | 'git --version': 2.7.4 | |
671 | 673 | repo_root: . |
672 | 674 | Dist::Zilla::Role::Git::StringFormatter: |
673 | 675 | time_zone: local |
681 | 683 | - origin |
682 | 684 | remotes_must_exist: 1 |
683 | 685 | Dist::Zilla::Role::Git::Repo: |
684 | 'git --version': 2.11.0 | |
686 | 'git --version': 2.7.4 | |
685 | 687 | repo_root: . |
686 | 688 | name: '@DROLSKY/Push version bump' |
687 | 689 | version: '2.041' |
37 | 37 | "Test::More" => "1.302015", |
38 | 38 | "Test::Without::Module" => 0 |
39 | 39 | }, |
40 | "VERSION" => "0.22", | |
40 | "VERSION" => "0.23", | |
41 | 41 | "test" => { |
42 | 42 | "TESTS" => "t/*.t t/named/*.t t/positional/*.t" |
43 | 43 | } |
3 | 3 | |
4 | 4 | # VERSION |
5 | 5 | |
6 | version 0.22 | |
6 | version 0.23 | |
7 | 7 | |
8 | 8 | # SYNOPSIS |
9 | 9 | |
179 | 179 | |
180 | 180 | # SUPPORT |
181 | 181 | |
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). | |
183 | 183 | |
184 | 184 | 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). | |
185 | 189 | |
186 | 190 | # DONATIONS |
187 | 191 | |
211 | 215 | |
212 | 216 | # COPYRIGHT AND LICENSE |
213 | 217 | |
214 | This software is Copyright (c) 2016 by Dave Rolsky. | |
218 | This software is Copyright (c) 2016 - 2017 by Dave Rolsky. | |
215 | 219 | |
216 | 220 | This is free software, licensed under: |
217 | 221 | |
218 | 222 | 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. |
33 | 33 | requires "Code::TidyAll::Plugin::Test::Vars" => "0.02"; |
34 | 34 | requires "Const::Fast" => "0.014"; |
35 | 35 | requires "File::Spec" => "0"; |
36 | requires "Hash::Merge" => "0"; | |
36 | 37 | requires "Hash::Util" => "0"; |
37 | 38 | requires "IO::Handle" => "0"; |
38 | 39 | requires "IPC::Open3" => "0"; |
40 | requires "List::AllUtils" => "0"; | |
39 | 41 | requires "Moose" => "2.0000"; |
40 | 42 | requires "Parallel::ForkManager" => "1.19"; |
41 | 43 | requires "Perl::Critic" => "1.126"; |
42 | 44 | requires "Perl::Tidy" => "20160302"; |
43 | 45 | requires "Pod::Coverage::TrustPod" => "0"; |
44 | 46 | requires "Pod::Wordlist" => "0"; |
47 | requires "Set::Scalar" => "0"; | |
45 | 48 | requires "Specio" => "0.14"; |
46 | 49 | requires "Sub::Util" => "1.40"; |
50 | requires "Test2::Bundle::Extended" => "0"; | |
51 | requires "Test2::Plugin::NoWarnings" => "0"; | |
52 | requires "Test2::Require::Perl" => "0"; | |
47 | 53 | requires "Test::CPAN::Changes" => "0.19"; |
48 | 54 | requires "Test::CPAN::Meta::JSON" => "0.16"; |
49 | 55 | requires "Test::Code::TidyAll" => "0.50"; |
59 | 65 | requires "Test::Vars" => "0.009"; |
60 | 66 | requires "Test::Version" => "2.05"; |
61 | 67 | requires "Type::Tiny" => "0"; |
68 | requires "Type::Utils" => "0"; | |
62 | 69 | requires "blib" => "1.01"; |
63 | 70 | requires "perl" => "5.006"; |
64 | 71 | }; |
1 | 1 | author = Dave Rolsky <autarch@urth.org> |
2 | 2 | license = Artistic_2_0 |
3 | 3 | copyright_holder = Dave Rolsky |
4 | copyright_year = 2016 | |
4 | 5 | |
5 | 6 | [@DROLSKY] |
6 | 7 | dist = Params-ValidationCompiler |
18 | 19 | -remove = Test::CleanNamespaces |
19 | 20 | |
20 | 21 | [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 | |
27 | 28 | |
28 | 29 | [Prereqs / Recommends] |
29 | 30 | Sub::Util = 1.40 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '0.22'; | |
5 | our $VERSION = '0.23'; | |
6 | 6 | |
7 | 7 | use Carp qw( croak ); |
8 | 8 | use Eval::Closure qw( eval_closure ); |
177 | 177 | sub _types { |
178 | 178 | my $self = shift; |
179 | 179 | |
180 | my @types; | |
180 | 181 | if ( ref $self->params eq 'HASH' ) { |
181 | return map { $_->{type} || () } | |
182 | @types = map { $_->{type} || () } | |
182 | 183 | grep { ref $_ } values %{ $self->params }; |
183 | 184 | } |
184 | 185 | elsif ( ref $self->params eq 'ARRAY' ) { |
185 | 186 | if ( $self->named_to_list ) { |
186 | 187 | my %p = @{ $self->params }; |
187 | return map { $_->{type} || () } grep { ref $_ } values %p; | |
188 | @types = map { $_->{type} || () } grep { ref $_ } values %p; | |
188 | 189 | } |
189 | 190 | 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; | |
194 | 199 | } |
195 | 200 | |
196 | 201 | sub subref { |
285 | 290 | # We check exists $spec->{optional} so as not to blow up on a |
286 | 291 | # restricted hash. |
287 | 292 | $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}; | |
290 | 294 | |
291 | 295 | $self->_add_named_default_assignment( |
292 | 296 | $access, |
478 | 482 | $self->_add_check_for_extra_positional_param_types( |
479 | 483 | scalar @specs, |
480 | 484 | $self->slurpy, |
485 | $access_var, | |
481 | 486 | ); |
482 | 487 | } |
483 | 488 | |
494 | 499 | |
495 | 500 | for my $spec ( @{ $self->params } ) { |
496 | 501 | $spec = ref $spec ? $spec : { optional => !$spec }; |
497 | if ( $spec->{optional} ) { | |
502 | if ( $spec->{optional} || exists $spec->{default} ) { | |
498 | 503 | $in_optional = 1; |
499 | 504 | } |
500 | 505 | elsif ($in_optional) { |
528 | 533 | } |
529 | 534 | |
530 | 535 | 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; | |
534 | 540 | |
535 | 541 | # We need to set the name argument to something that won't conflict with |
536 | 542 | # names someone would actually use for a parameter. |
537 | 543 | my $check = join q{}, $self->_type_check( |
538 | '$_[$i]', | |
544 | sprintf( '%s[$i]', $access_var ), | |
539 | 545 | '__PCC extra parameters__', |
540 | 546 | $type, |
541 | 547 | ); |
896 | 902 | |
897 | 903 | =head1 VERSION |
898 | 904 | |
899 | version 0.22 | |
905 | version 0.23 | |
900 | 906 | |
901 | 907 | =for Pod::Coverage .* |
902 | 908 | |
903 | 909 | =head1 SUPPORT |
904 | 910 | |
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>. | |
906 | 912 | |
907 | 913 | I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
908 | 914 | |
915 | =head1 SOURCE | |
916 | ||
917 | The source code repository for Params-ValidationCompiler can be found at L<https://github.com/houseabsolute/Params-ValidationCompiler>. | |
918 | ||
909 | 919 | =head1 AUTHOR |
910 | 920 | |
911 | 921 | Dave Rolsky <autarch@urth.org> |
912 | 922 | |
913 | 923 | =head1 COPYRIGHT AND LICENSE |
914 | 924 | |
915 | This software is Copyright (c) 2016 by Dave Rolsky. | |
925 | This software is Copyright (c) 2016 - 2017 by Dave Rolsky. | |
916 | 926 | |
917 | 927 | This is free software, licensed under: |
918 | 928 | |
919 | 929 | The Artistic License 2.0 (GPL Compatible) |
920 | 930 | |
931 | The full text of the license can be found in the | |
932 | F<LICENSE> file included with this distribution. | |
933 | ||
921 | 934 | =cut |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '0.22'; | |
5 | our $VERSION = '0.23'; | |
6 | 6 | |
7 | 7 | use Exception::Class ( |
8 | 8 | 'Params::ValidationCompiler::Exception::BadArguments', |
40 | 40 | |
41 | 41 | =head1 VERSION |
42 | 42 | |
43 | version 0.22 | |
43 | version 0.23 | |
44 | 44 | |
45 | 45 | =head1 DESCRIPTION |
46 | 46 | |
86 | 86 | |
87 | 87 | =head1 SUPPORT |
88 | 88 | |
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>. | |
90 | 90 | |
91 | 91 | 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>. | |
92 | 96 | |
93 | 97 | =head1 AUTHOR |
94 | 98 | |
96 | 100 | |
97 | 101 | =head1 COPYRIGHT AND LICENSE |
98 | 102 | |
99 | This software is Copyright (c) 2016 by Dave Rolsky. | |
103 | This software is Copyright (c) 2016 - 2017 by Dave Rolsky. | |
100 | 104 | |
101 | 105 | This is free software, licensed under: |
102 | 106 | |
103 | 107 | The Artistic License 2.0 (GPL Compatible) |
104 | 108 | |
109 | The full text of the license can be found in the | |
110 | F<LICENSE> file included with this distribution. | |
111 | ||
105 | 112 | =cut |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '0.22'; | |
5 | our $VERSION = '0.23'; | |
6 | 6 | |
7 | 7 | use Params::ValidationCompiler::Compiler; |
8 | 8 | |
39 | 39 | |
40 | 40 | =head1 VERSION |
41 | 41 | |
42 | version 0.22 | |
42 | version 0.23 | |
43 | 43 | |
44 | 44 | =head1 SYNOPSIS |
45 | 45 | |
229 | 229 | |
230 | 230 | =head1 SUPPORT |
231 | 231 | |
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>. | |
233 | 233 | |
234 | 234 | 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>. | |
235 | 239 | |
236 | 240 | =head1 DONATIONS |
237 | 241 | |
272 | 276 | |
273 | 277 | =head1 COPYRIGHT AND LICENSE |
274 | 278 | |
275 | This software is Copyright (c) 2016 by Dave Rolsky. | |
279 | This software is Copyright (c) 2016 - 2017 by Dave Rolsky. | |
276 | 280 | |
277 | 281 | This is free software, licensed under: |
278 | 282 | |
279 | 283 | The Artistic License 2.0 (GPL Compatible) |
280 | 284 | |
285 | The full text of the license can be found in the | |
286 | F<LICENSE> file included with this distribution. | |
287 | ||
281 | 288 | =cut |
8 | 8 | 'Code::TidyAll::Plugin::Test::Vars' => '0.02', |
9 | 9 | 'Const::Fast' => '0.014', |
10 | 10 | 'File::Spec' => '0', |
11 | 'Hash::Merge' => '0', | |
11 | 12 | 'Hash::Util' => '0', |
12 | 13 | 'IO::Handle' => '0', |
13 | 14 | 'IPC::Open3' => '0', |
15 | 'List::AllUtils' => '0', | |
14 | 16 | 'Moose' => '2.0000', |
15 | 17 | 'Parallel::ForkManager' => '1.19', |
16 | 18 | 'Perl::Critic' => '1.126', |
17 | 19 | 'Perl::Tidy' => '20160302', |
18 | 20 | 'Pod::Coverage::TrustPod' => '0', |
19 | 21 | 'Pod::Wordlist' => '0', |
22 | 'Set::Scalar' => '0', | |
20 | 23 | 'Specio' => '0.14', |
21 | 24 | 'Sub::Util' => '1.40', |
25 | 'Test2::Bundle::Extended' => '0', | |
26 | 'Test2::Plugin::NoWarnings' => '0', | |
27 | 'Test2::Require::Perl' => '0', | |
22 | 28 | 'Test::CPAN::Changes' => '0.19', |
23 | 29 | 'Test::CPAN::Meta::JSON' => '0.16', |
24 | 30 | 'Test::Code::TidyAll' => '0.50', |
34 | 40 | 'Test::Vars' => '0.009', |
35 | 41 | 'Test::Version' => '2.05', |
36 | 42 | 'Type::Tiny' => '0', |
43 | 'Type::Utils' => '0', | |
37 | 44 | 'blib' => '1.01', |
38 | 45 | 'perl' => '5.006' |
39 | 46 | } |
36 | 36 | ); |
37 | 37 | } |
38 | 38 | |
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 | ||
39 | 67 | done_testing(); |
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 |
7 | 7 | ignore = t/release-* |
8 | 8 | ignore = t/zzz-* |
9 | 9 | ignore = xt/**/* |
10 | argv = --profile=$ROOT/perlcriticrc | |
11 | ||
12 | [PerlCritic non-auto-generated xt] | |
13 | select = xt/author/matrix.t | |
10 | 14 | argv = --profile=$ROOT/perlcriticrc |
11 | 15 | |
12 | 16 | [PerlTidy] |
21 | 25 | ignore = xt/**/* |
22 | 26 | argv = --profile=$ROOT/perltidyrc |
23 | 27 | |
28 | [PerlTidy non-auto-generated xt] | |
29 | select = xt/author/matrix.t | |
30 | argv = --profile=$ROOT/perltidyrc | |
31 | ||
24 | 32 | [Test::Vars] |
25 | 33 | select = **/*.pm |
26 | 34 | 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 |