Imported Upstream version 1.21
Lucas Kanashiro
8 years ago
19 | 19 | "Ilya Martynov <ilya\@martynov.org>" |
20 | 20 | ], |
21 | 21 | "dist_name" => "Params-Validate", |
22 | "dist_version" => "1.20", | |
22 | "dist_version" => "1.21", | |
23 | 23 | "license" => "artistic_2", |
24 | 24 | "module_name" => "Params::Validate", |
25 | 25 | "recommends" => {}, |
26 | 26 | "recursive_test_files" => 1, |
27 | 27 | "requires" => { |
28 | "Attribute::Handlers" => "0.79", | |
29 | 28 | "Carp" => 0, |
30 | 29 | "Exporter" => 0, |
31 | 30 | "Module::Implementation" => 0, |
32 | 31 | "Scalar::Util" => "1.10", |
33 | 32 | "XSLoader" => 0, |
34 | "attributes" => 0, | |
35 | 33 | "perl" => "5.008001", |
36 | 34 | "strict" => 0, |
37 | 35 | "vars" => 0, |
0 | 1.21 2015-07-18 | |
1 | ||
2 | - Attribute::Params::Validate is now in its own distro, and needs a new | |
3 | maintainer. If you would like to maintain it, please contact me. | |
4 | ||
5 | ||
0 | 6 | 1.20 2015-06-28 |
1 | 7 | |
2 | 8 | - Fixed a bug with stack handling in the XS code. If a callback sub caused |
12 | 12 | cpanfile |
13 | 13 | dist.ini |
14 | 14 | inc/MyModuleBuild.pm |
15 | lib/Attribute/Params/Validate.pm | |
16 | 15 | lib/Params/Validate.pm |
17 | 16 | lib/Params/Validate/Constants.pm |
18 | 17 | lib/Params/Validate/PP.pm |
26 | 25 | t/00-report-prereqs.t |
27 | 26 | t/01-validate.t |
28 | 27 | t/02-noop.t |
29 | t/03-attribute.t | |
30 | 28 | t/04-defaults.t |
31 | 29 | t/05-noop_default.t |
32 | 30 | t/06-options.t |
80 | 78 | t/release-portability.t |
81 | 79 | t/release-pp-01-validate.t |
82 | 80 | t/release-pp-02-noop.t |
83 | t/release-pp-03-attribute.t | |
84 | 81 | t/release-pp-04-defaults.t |
85 | 82 | t/release-pp-05-noop_default.t |
86 | 83 | t/release-pp-06-options.t |
41 | 41 | "Test::NoTabs" : "0", |
42 | 42 | "Test::Pod" : "1.41", |
43 | 43 | "Test::Pod::Coverage" : "1.08", |
44 | "Test::Pod::LinkCheck" : "0", | |
45 | "Test::Pod::No404s" : "0", | |
44 | 46 | "Test::Spelling" : "0.12", |
45 | 47 | "Test::Synopsis" : "0", |
46 | 48 | "Test::Taint" : "0.02" |
48 | 50 | }, |
49 | 51 | "runtime" : { |
50 | 52 | "requires" : { |
51 | "Attribute::Handlers" : "0.79", | |
52 | 53 | "Carp" : "0", |
53 | 54 | "Exporter" : "0", |
54 | 55 | "Module::Implementation" : "0", |
55 | 56 | "Scalar::Util" : "1.10", |
56 | 57 | "XSLoader" : "0", |
57 | "attributes" : "0", | |
58 | 58 | "perl" : "5.008001", |
59 | 59 | "strict" : "0", |
60 | 60 | "vars" : "0", |
82 | 82 | } |
83 | 83 | }, |
84 | 84 | "provides" : { |
85 | "Attribute::Params::Validate" : { | |
86 | "file" : "lib/Attribute/Params/Validate.pm", | |
87 | "version" : "1.20" | |
88 | }, | |
89 | 85 | "Params::Validate" : { |
90 | 86 | "file" : "lib/Params/Validate.pm", |
91 | "version" : "1.20" | |
87 | "version" : "1.21" | |
92 | 88 | }, |
93 | 89 | "Params::Validate::Constants" : { |
94 | 90 | "file" : "lib/Params/Validate/Constants.pm", |
95 | "version" : "1.20" | |
91 | "version" : "1.21" | |
96 | 92 | }, |
97 | 93 | "Params::Validate::PP" : { |
98 | 94 | "file" : "lib/Params/Validate/PP.pm", |
99 | "version" : "1.20" | |
95 | "version" : "1.21" | |
100 | 96 | }, |
101 | 97 | "Params::Validate::XS" : { |
102 | 98 | "file" : "lib/Params/Validate/XS.pm", |
103 | "version" : "1.20" | |
99 | "version" : "1.21" | |
104 | 100 | } |
105 | 101 | }, |
106 | 102 | "release_status" : "stable", |
116 | 112 | "web" : "https://github.com/autarch/Params-Validate" |
117 | 113 | } |
118 | 114 | }, |
119 | "version" : "1.20", | |
115 | "version" : "1.21", | |
120 | 116 | "x_Dist_Zilla" : { |
121 | 117 | "perl" : { |
122 | "version" : "5.020001" | |
118 | "version" : "5.022000" | |
123 | 119 | }, |
124 | 120 | "plugins" : [ |
125 | 121 | { |
142 | 138 | "config" : { |
143 | 139 | "Dist::Zilla::Plugin::GatherDir" : { |
144 | 140 | "exclude_filename" : [ |
141 | "Build.PL", | |
142 | "LICENSE", | |
145 | 143 | "README.md", |
146 | 144 | "cpanfile", |
147 | "LICENSE", | |
148 | "Makefile.PL", | |
149 | "Build.PL" | |
145 | "Makefile.PL" | |
150 | 146 | ], |
151 | 147 | "exclude_match" : [], |
152 | 148 | "follow_symlinks" : "0", |
156 | 152 | "root" : "." |
157 | 153 | }, |
158 | 154 | "Dist::Zilla::Plugin::Git::GatherDir" : { |
159 | "include_untracked" : "0" | |
155 | "include_untracked" : 0 | |
160 | 156 | } |
161 | 157 | }, |
162 | 158 | "name" : "@DROLSKY/Git::GatherDir", |
163 | "version" : "2.035" | |
159 | "version" : "2.036" | |
164 | 160 | }, |
165 | 161 | { |
166 | 162 | "class" : "Dist::Zilla::Plugin::GitHub::Meta", |
245 | 241 | }, |
246 | 242 | { |
247 | 243 | "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", |
244 | "config" : { | |
245 | "Dist::Zilla::Role::FileWatcher" : { | |
246 | "version" : "0.006" | |
247 | } | |
248 | }, | |
248 | 249 | "name" : "@DROLSKY/README.md in build", |
249 | 250 | "version" : "0.150250" |
250 | 251 | }, |
251 | 252 | { |
252 | 253 | "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", |
254 | "config" : { | |
255 | "Dist::Zilla::Role::FileWatcher" : { | |
256 | "version" : "0.006" | |
257 | } | |
258 | }, | |
253 | 259 | "name" : "@DROLSKY/README.md in root", |
254 | 260 | "version" : "0.150250" |
255 | 261 | }, |
336 | 342 | { |
337 | 343 | "class" : "Dist::Zilla::Plugin::DROLSKY::Contributors", |
338 | 344 | "name" : "@DROLSKY/DROLSKY::Contributors", |
339 | "version" : "0.34" | |
345 | "version" : "0.36" | |
340 | 346 | }, |
341 | 347 | { |
342 | 348 | "class" : "Dist::Zilla::Plugin::DROLSKY::License", |
343 | 349 | "name" : "@DROLSKY/DROLSKY::License", |
344 | "version" : "0.34" | |
350 | "version" : "0.36" | |
345 | 351 | }, |
346 | 352 | { |
347 | 353 | "class" : "Dist::Zilla::Plugin::DROLSKY::TidyAll", |
348 | 354 | "name" : "@DROLSKY/DROLSKY::TidyAll", |
349 | "version" : "0.34" | |
355 | "version" : "0.36" | |
350 | 356 | }, |
351 | 357 | { |
352 | 358 | "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", |
372 | 378 | "class" : "Dist::Zilla::Plugin::Git::Contributors", |
373 | 379 | "config" : { |
374 | 380 | "Dist::Zilla::Plugin::Git::Contributors" : { |
375 | "include_authors" : "0", | |
376 | "include_releaser" : "1", | |
381 | "include_authors" : 0, | |
382 | "include_releaser" : 1, | |
377 | 383 | "order_by" : "name", |
378 | "paths" : [] | |
384 | "paths" : [ | |
385 | "." | |
386 | ] | |
379 | 387 | } |
380 | 388 | }, |
381 | 389 | "name" : "@DROLSKY/Git::Contributors", |
382 | "version" : "0.011" | |
390 | "version" : "0.012" | |
383 | 391 | }, |
384 | 392 | { |
385 | 393 | "class" : "Dist::Zilla::Plugin::InstallGuide", |
418 | 426 | { |
419 | 427 | "class" : "Pod::Weaver::Plugin::EnsurePod5", |
420 | 428 | "name" : "@CorePrep/EnsurePod5", |
421 | "version" : "4.010" | |
429 | "version" : "4.012" | |
422 | 430 | }, |
423 | 431 | { |
424 | 432 | "class" : "Pod::Weaver::Plugin::H1Nester", |
425 | 433 | "name" : "@CorePrep/H1Nester", |
426 | "version" : "4.010" | |
434 | "version" : "4.012" | |
427 | 435 | }, |
428 | 436 | { |
429 | 437 | "class" : "Pod::Weaver::Section::Name", |
430 | 438 | "name" : "Name", |
431 | "version" : "4.010" | |
439 | "version" : "4.012" | |
432 | 440 | }, |
433 | 441 | { |
434 | 442 | "class" : "Pod::Weaver::Section::Version", |
435 | 443 | "name" : "Version", |
436 | "version" : "4.010" | |
444 | "version" : "4.012" | |
437 | 445 | }, |
438 | 446 | { |
439 | 447 | "class" : "Pod::Weaver::Section::Region", |
440 | 448 | "name" : "prelude", |
441 | "version" : "4.010" | |
449 | "version" : "4.012" | |
442 | 450 | }, |
443 | 451 | { |
444 | 452 | "class" : "Pod::Weaver::Section::Generic", |
445 | 453 | "name" : "SYNOPSIS", |
446 | "version" : "4.010" | |
454 | "version" : "4.012" | |
447 | 455 | }, |
448 | 456 | { |
449 | 457 | "class" : "Pod::Weaver::Section::Generic", |
450 | 458 | "name" : "DESCRIPTION", |
451 | "version" : "4.010" | |
459 | "version" : "4.012" | |
452 | 460 | }, |
453 | 461 | { |
454 | 462 | "class" : "Pod::Weaver::Section::Leftovers", |
455 | 463 | "name" : "Leftovers", |
456 | "version" : "4.010" | |
464 | "version" : "4.012" | |
457 | 465 | }, |
458 | 466 | { |
459 | 467 | "class" : "Pod::Weaver::Section::Region", |
460 | 468 | "name" : "postlude", |
461 | "version" : "4.010" | |
469 | "version" : "4.012" | |
462 | 470 | }, |
463 | 471 | { |
464 | 472 | "class" : "Pod::Weaver::Section::Authors", |
465 | 473 | "name" : "Authors", |
466 | "version" : "4.010" | |
474 | "version" : "4.012" | |
467 | 475 | }, |
468 | 476 | { |
469 | 477 | "class" : "Pod::Weaver::Section::Contributors", |
473 | 481 | { |
474 | 482 | "class" : "Pod::Weaver::Section::Legal", |
475 | 483 | "name" : "Legal", |
476 | "version" : "4.010" | |
484 | "version" : "4.012" | |
477 | 485 | } |
478 | 486 | ] |
479 | 487 | } |
523 | 531 | "version" : "0.15" |
524 | 532 | }, |
525 | 533 | { |
526 | "class" : "Dist::Zilla::Plugin::Test::Pod::LinkCheck", | |
527 | "name" : "@DROLSKY/Test::Pod::LinkCheck", | |
528 | "version" : "1.001" | |
529 | }, | |
530 | { | |
531 | "class" : "Dist::Zilla::Plugin::Test::Pod::No404s", | |
532 | "name" : "@DROLSKY/Test::Pod::No404s", | |
533 | "version" : "1.001" | |
534 | }, | |
535 | { | |
536 | 534 | "class" : "Dist::Zilla::Plugin::Test::Portability", |
537 | 535 | "name" : "@DROLSKY/Test::Portability", |
538 | 536 | "version" : "2.000006" |
572 | 570 | }, |
573 | 571 | "Dist::Zilla::Role::Git::DirtyFiles" : { |
574 | 572 | "allow_dirty" : [ |
575 | "README.md", | |
576 | "cpanfile", | |
573 | "Build.PL", | |
574 | "CONTRIBUTING.md", | |
575 | "Changes", | |
577 | 576 | "LICENSE", |
578 | 577 | "Makefile.PL", |
579 | "Build.PL", | |
580 | "Changes", | |
581 | "CONTRIBUTING.md" | |
578 | "README.md", | |
579 | "cpanfile" | |
582 | 580 | ], |
583 | 581 | "allow_dirty_match" : [], |
584 | 582 | "changelog" : "Changes" |
588 | 586 | } |
589 | 587 | }, |
590 | 588 | "name" : "@DROLSKY/Git::Check", |
591 | "version" : "2.035" | |
589 | "version" : "2.036" | |
592 | 590 | }, |
593 | 591 | { |
594 | 592 | "class" : "Dist::Zilla::Plugin::Git::Commit", |
595 | 593 | "config" : { |
596 | 594 | "Dist::Zilla::Plugin::Git::Commit" : { |
597 | 595 | "add_files_in" : [], |
598 | "commit_msg" : "v%v%n%n%c", | |
599 | "time_zone" : "local" | |
596 | "commit_msg" : "v%v%n%n%c" | |
600 | 597 | }, |
601 | 598 | "Dist::Zilla::Role::Git::DirtyFiles" : { |
602 | 599 | "allow_dirty" : [ |
603 | "README.md", | |
604 | "cpanfile", | |
600 | "Build.PL", | |
601 | "CONTRIBUTING.md", | |
602 | "Changes", | |
605 | 603 | "LICENSE", |
606 | 604 | "Makefile.PL", |
607 | "Build.PL", | |
608 | "Changes", | |
609 | "CONTRIBUTING.md" | |
605 | "README.md", | |
606 | "cpanfile" | |
610 | 607 | ], |
611 | 608 | "allow_dirty_match" : [], |
612 | 609 | "changelog" : "Changes" |
613 | 610 | }, |
614 | 611 | "Dist::Zilla::Role::Git::Repo" : { |
615 | 612 | "repo_root" : "." |
613 | }, | |
614 | "Dist::Zilla::Role::Git::StringFormatter" : { | |
615 | "time_zone" : "local" | |
616 | 616 | } |
617 | 617 | }, |
618 | 618 | "name" : "@DROLSKY/commit generated files", |
619 | "version" : "2.035" | |
619 | "version" : "2.036" | |
620 | 620 | }, |
621 | 621 | { |
622 | 622 | "class" : "Dist::Zilla::Plugin::Git::Tag", |
623 | 623 | "config" : { |
624 | 624 | "Dist::Zilla::Plugin::Git::Tag" : { |
625 | 625 | "branch" : null, |
626 | "changelog" : "Changes", | |
626 | 627 | "signed" : 0, |
627 | "tag" : "v1.20", | |
628 | "tag" : "v1.21", | |
628 | 629 | "tag_format" : "v%v", |
629 | "tag_message" : "v%v", | |
630 | "time_zone" : "local" | |
630 | "tag_message" : "v%v" | |
631 | 631 | }, |
632 | 632 | "Dist::Zilla::Role::Git::Repo" : { |
633 | 633 | "repo_root" : "." |
634 | }, | |
635 | "Dist::Zilla::Role::Git::StringFormatter" : { | |
636 | "time_zone" : "local" | |
634 | 637 | } |
635 | 638 | }, |
636 | 639 | "name" : "@DROLSKY/Git::Tag", |
637 | "version" : "2.035" | |
640 | "version" : "2.036" | |
638 | 641 | }, |
639 | 642 | { |
640 | 643 | "class" : "Dist::Zilla::Plugin::Git::Push", |
650 | 653 | } |
651 | 654 | }, |
652 | 655 | "name" : "@DROLSKY/Git::Push", |
653 | "version" : "2.035" | |
656 | "version" : "2.036" | |
654 | 657 | }, |
655 | 658 | { |
656 | 659 | "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease", |
662 | 665 | "config" : { |
663 | 666 | "Dist::Zilla::Plugin::Git::Commit" : { |
664 | 667 | "add_files_in" : [], |
665 | "commit_msg" : "Bump version after release", | |
666 | "time_zone" : "local" | |
668 | "commit_msg" : "Bump version after release" | |
667 | 669 | }, |
668 | 670 | "Dist::Zilla::Role::Git::DirtyFiles" : { |
669 | 671 | "allow_dirty" : [ |
670 | "dist.ini", | |
671 | "Changes" | |
672 | "Changes", | |
673 | "dist.ini" | |
672 | 674 | ], |
673 | 675 | "allow_dirty_match" : [ |
674 | 676 | "(?^:.+)" |
677 | 679 | }, |
678 | 680 | "Dist::Zilla::Role::Git::Repo" : { |
679 | 681 | "repo_root" : "." |
682 | }, | |
683 | "Dist::Zilla::Role::Git::StringFormatter" : { | |
684 | "time_zone" : "local" | |
680 | 685 | } |
681 | 686 | }, |
682 | 687 | "name" : "@DROLSKY/commit version bump", |
683 | "version" : "2.035" | |
688 | "version" : "2.036" | |
684 | 689 | }, |
685 | 690 | { |
686 | 691 | "class" : "Dist::Zilla::Plugin::Git::Push", |
696 | 701 | } |
697 | 702 | }, |
698 | 703 | "name" : "@DROLSKY/push version bump", |
699 | "version" : "2.035" | |
704 | "version" : "2.036" | |
705 | }, | |
706 | { | |
707 | "class" : "Dist::Zilla::Plugin::Test::Pod::LinkCheck", | |
708 | "name" : "@DROLSKY/Test::Pod::LinkCheck", | |
709 | "version" : "1.002" | |
710 | }, | |
711 | { | |
712 | "class" : "Dist::Zilla::Plugin::Test::Pod::No404s", | |
713 | "name" : "@DROLSKY/Test::Pod::No404s", | |
714 | "version" : "1.002" | |
700 | 715 | }, |
701 | 716 | { |
702 | 717 | "class" : "Dist::Zilla::Plugin::Prereqs", |
26 | 26 | version: '1.4' |
27 | 27 | name: Params-Validate |
28 | 28 | provides: |
29 | Attribute::Params::Validate: | |
30 | file: lib/Attribute/Params/Validate.pm | |
31 | version: '1.20' | |
32 | 29 | Params::Validate: |
33 | 30 | file: lib/Params/Validate.pm |
34 | version: '1.20' | |
31 | version: '1.21' | |
35 | 32 | Params::Validate::Constants: |
36 | 33 | file: lib/Params/Validate/Constants.pm |
37 | version: '1.20' | |
34 | version: '1.21' | |
38 | 35 | Params::Validate::PP: |
39 | 36 | file: lib/Params/Validate/PP.pm |
40 | version: '1.20' | |
37 | version: '1.21' | |
41 | 38 | Params::Validate::XS: |
42 | 39 | file: lib/Params/Validate/XS.pm |
43 | version: '1.20' | |
40 | version: '1.21' | |
44 | 41 | requires: |
45 | Attribute::Handlers: '0.79' | |
46 | 42 | Carp: '0' |
47 | 43 | Exporter: '0' |
48 | 44 | Module::Implementation: '0' |
49 | 45 | Scalar::Util: '1.10' |
50 | 46 | XSLoader: '0' |
51 | attributes: '0' | |
52 | 47 | perl: '5.008001' |
53 | 48 | strict: '0' |
54 | 49 | vars: '0' |
57 | 52 | bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Params-Validate |
58 | 53 | homepage: http://metacpan.org/release/Params-Validate |
59 | 54 | repository: git://github.com/autarch/Params-Validate.git |
60 | version: '1.20' | |
55 | version: '1.21' | |
61 | 56 | x_Dist_Zilla: |
62 | 57 | perl: |
63 | version: '5.020001' | |
58 | version: '5.022000' | |
64 | 59 | plugins: |
65 | 60 | - |
66 | 61 | class: Dist::Zilla::Plugin::Authority |
79 | 74 | config: |
80 | 75 | Dist::Zilla::Plugin::GatherDir: |
81 | 76 | exclude_filename: |
77 | - Build.PL | |
78 | - LICENSE | |
82 | 79 | - README.md |
83 | 80 | - cpanfile |
84 | - LICENSE | |
85 | 81 | - Makefile.PL |
86 | - Build.PL | |
87 | 82 | exclude_match: [] |
88 | 83 | follow_symlinks: '0' |
89 | 84 | include_dotfiles: '0' |
91 | 86 | prune_directory: [] |
92 | 87 | root: . |
93 | 88 | Dist::Zilla::Plugin::Git::GatherDir: |
94 | include_untracked: '0' | |
89 | include_untracked: 0 | |
95 | 90 | name: '@DROLSKY/Git::GatherDir' |
96 | version: '2.035' | |
91 | version: '2.036' | |
97 | 92 | - |
98 | 93 | class: Dist::Zilla::Plugin::GitHub::Meta |
99 | 94 | name: '@DROLSKY/GitHub::Meta' |
157 | 152 | version: '0.045' |
158 | 153 | - |
159 | 154 | class: Dist::Zilla::Plugin::ReadmeAnyFromPod |
155 | config: | |
156 | Dist::Zilla::Role::FileWatcher: | |
157 | version: '0.006' | |
160 | 158 | name: '@DROLSKY/README.md in build' |
161 | 159 | version: '0.150250' |
162 | 160 | - |
163 | 161 | class: Dist::Zilla::Plugin::ReadmeAnyFromPod |
162 | config: | |
163 | Dist::Zilla::Role::FileWatcher: | |
164 | version: '0.006' | |
164 | 165 | name: '@DROLSKY/README.md in root' |
165 | 166 | version: '0.150250' |
166 | 167 | - |
230 | 231 | - |
231 | 232 | class: Dist::Zilla::Plugin::DROLSKY::Contributors |
232 | 233 | name: '@DROLSKY/DROLSKY::Contributors' |
233 | version: '0.34' | |
234 | version: '0.36' | |
234 | 235 | - |
235 | 236 | class: Dist::Zilla::Plugin::DROLSKY::License |
236 | 237 | name: '@DROLSKY/DROLSKY::License' |
237 | version: '0.34' | |
238 | version: '0.36' | |
238 | 239 | - |
239 | 240 | class: Dist::Zilla::Plugin::DROLSKY::TidyAll |
240 | 241 | name: '@DROLSKY/DROLSKY::TidyAll' |
241 | version: '0.34' | |
242 | version: '0.36' | |
242 | 243 | - |
243 | 244 | class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch |
244 | 245 | config: |
257 | 258 | class: Dist::Zilla::Plugin::Git::Contributors |
258 | 259 | config: |
259 | 260 | Dist::Zilla::Plugin::Git::Contributors: |
260 | include_authors: '0' | |
261 | include_releaser: '1' | |
261 | include_authors: 0 | |
262 | include_releaser: 1 | |
262 | 263 | order_by: name |
263 | paths: [] | |
264 | paths: | |
265 | - . | |
264 | 266 | name: '@DROLSKY/Git::Contributors' |
265 | version: '0.011' | |
267 | version: '0.012' | |
266 | 268 | - |
267 | 269 | class: Dist::Zilla::Plugin::InstallGuide |
268 | 270 | name: '@DROLSKY/InstallGuide' |
294 | 296 | - |
295 | 297 | class: Pod::Weaver::Plugin::EnsurePod5 |
296 | 298 | name: '@CorePrep/EnsurePod5' |
297 | version: '4.010' | |
299 | version: '4.012' | |
298 | 300 | - |
299 | 301 | class: Pod::Weaver::Plugin::H1Nester |
300 | 302 | name: '@CorePrep/H1Nester' |
301 | version: '4.010' | |
303 | version: '4.012' | |
302 | 304 | - |
303 | 305 | class: Pod::Weaver::Section::Name |
304 | 306 | name: Name |
305 | version: '4.010' | |
307 | version: '4.012' | |
306 | 308 | - |
307 | 309 | class: Pod::Weaver::Section::Version |
308 | 310 | name: Version |
309 | version: '4.010' | |
311 | version: '4.012' | |
310 | 312 | - |
311 | 313 | class: Pod::Weaver::Section::Region |
312 | 314 | name: prelude |
313 | version: '4.010' | |
315 | version: '4.012' | |
314 | 316 | - |
315 | 317 | class: Pod::Weaver::Section::Generic |
316 | 318 | name: SYNOPSIS |
317 | version: '4.010' | |
319 | version: '4.012' | |
318 | 320 | - |
319 | 321 | class: Pod::Weaver::Section::Generic |
320 | 322 | name: DESCRIPTION |
321 | version: '4.010' | |
323 | version: '4.012' | |
322 | 324 | - |
323 | 325 | class: Pod::Weaver::Section::Leftovers |
324 | 326 | name: Leftovers |
325 | version: '4.010' | |
327 | version: '4.012' | |
326 | 328 | - |
327 | 329 | class: Pod::Weaver::Section::Region |
328 | 330 | name: postlude |
329 | version: '4.010' | |
331 | version: '4.012' | |
330 | 332 | - |
331 | 333 | class: Pod::Weaver::Section::Authors |
332 | 334 | name: Authors |
333 | version: '4.010' | |
335 | version: '4.012' | |
334 | 336 | - |
335 | 337 | class: Pod::Weaver::Section::Contributors |
336 | 338 | name: Contributors |
338 | 340 | - |
339 | 341 | class: Pod::Weaver::Section::Legal |
340 | 342 | name: Legal |
341 | version: '4.010' | |
343 | version: '4.012' | |
342 | 344 | name: '@DROLSKY/SurgicalPodWeaver' |
343 | 345 | version: '0.0023' |
344 | 346 | - |
372 | 374 | - ':TestFiles' |
373 | 375 | name: '@DROLSKY/Test::NoTabs' |
374 | 376 | version: '0.15' |
375 | - | |
376 | class: Dist::Zilla::Plugin::Test::Pod::LinkCheck | |
377 | name: '@DROLSKY/Test::Pod::LinkCheck' | |
378 | version: '1.001' | |
379 | - | |
380 | class: Dist::Zilla::Plugin::Test::Pod::No404s | |
381 | name: '@DROLSKY/Test::Pod::No404s' | |
382 | version: '1.001' | |
383 | 377 | - |
384 | 378 | class: Dist::Zilla::Plugin::Test::Portability |
385 | 379 | name: '@DROLSKY/Test::Portability' |
412 | 406 | untracked_files: die |
413 | 407 | Dist::Zilla::Role::Git::DirtyFiles: |
414 | 408 | allow_dirty: |
409 | - Build.PL | |
410 | - CONTRIBUTING.md | |
411 | - Changes | |
412 | - LICENSE | |
413 | - Makefile.PL | |
415 | 414 | - README.md |
416 | 415 | - cpanfile |
417 | - LICENSE | |
418 | - Makefile.PL | |
419 | - Build.PL | |
420 | - Changes | |
421 | - CONTRIBUTING.md | |
422 | 416 | allow_dirty_match: [] |
423 | 417 | changelog: Changes |
424 | 418 | Dist::Zilla::Role::Git::Repo: |
425 | 419 | repo_root: . |
426 | 420 | name: '@DROLSKY/Git::Check' |
427 | version: '2.035' | |
421 | version: '2.036' | |
428 | 422 | - |
429 | 423 | class: Dist::Zilla::Plugin::Git::Commit |
430 | 424 | config: |
431 | 425 | Dist::Zilla::Plugin::Git::Commit: |
432 | 426 | add_files_in: [] |
433 | 427 | commit_msg: v%v%n%n%c |
434 | time_zone: local | |
435 | 428 | Dist::Zilla::Role::Git::DirtyFiles: |
436 | 429 | allow_dirty: |
430 | - Build.PL | |
431 | - CONTRIBUTING.md | |
432 | - Changes | |
433 | - LICENSE | |
434 | - Makefile.PL | |
437 | 435 | - README.md |
438 | 436 | - cpanfile |
439 | - LICENSE | |
440 | - Makefile.PL | |
441 | - Build.PL | |
442 | - Changes | |
443 | - CONTRIBUTING.md | |
444 | 437 | allow_dirty_match: [] |
445 | 438 | changelog: Changes |
446 | 439 | Dist::Zilla::Role::Git::Repo: |
447 | 440 | repo_root: . |
441 | Dist::Zilla::Role::Git::StringFormatter: | |
442 | time_zone: local | |
448 | 443 | name: '@DROLSKY/commit generated files' |
449 | version: '2.035' | |
444 | version: '2.036' | |
450 | 445 | - |
451 | 446 | class: Dist::Zilla::Plugin::Git::Tag |
452 | 447 | config: |
453 | 448 | Dist::Zilla::Plugin::Git::Tag: |
454 | 449 | branch: ~ |
450 | changelog: Changes | |
455 | 451 | signed: 0 |
456 | tag: v1.20 | |
452 | tag: v1.21 | |
457 | 453 | tag_format: v%v |
458 | 454 | tag_message: v%v |
455 | Dist::Zilla::Role::Git::Repo: | |
456 | repo_root: . | |
457 | Dist::Zilla::Role::Git::StringFormatter: | |
459 | 458 | time_zone: local |
460 | Dist::Zilla::Role::Git::Repo: | |
461 | repo_root: . | |
462 | 459 | name: '@DROLSKY/Git::Tag' |
463 | version: '2.035' | |
460 | version: '2.036' | |
464 | 461 | - |
465 | 462 | class: Dist::Zilla::Plugin::Git::Push |
466 | 463 | config: |
471 | 468 | Dist::Zilla::Role::Git::Repo: |
472 | 469 | repo_root: . |
473 | 470 | name: '@DROLSKY/Git::Push' |
474 | version: '2.035' | |
471 | version: '2.036' | |
475 | 472 | - |
476 | 473 | class: Dist::Zilla::Plugin::BumpVersionAfterRelease |
477 | 474 | name: '@DROLSKY/BumpVersionAfterRelease' |
482 | 479 | Dist::Zilla::Plugin::Git::Commit: |
483 | 480 | add_files_in: [] |
484 | 481 | commit_msg: 'Bump version after release' |
485 | time_zone: local | |
486 | 482 | Dist::Zilla::Role::Git::DirtyFiles: |
487 | 483 | allow_dirty: |
484 | - Changes | |
488 | 485 | - dist.ini |
489 | - Changes | |
490 | 486 | allow_dirty_match: |
491 | 487 | - (?^:.+) |
492 | 488 | changelog: Changes |
493 | 489 | Dist::Zilla::Role::Git::Repo: |
494 | 490 | repo_root: . |
491 | Dist::Zilla::Role::Git::StringFormatter: | |
492 | time_zone: local | |
495 | 493 | name: '@DROLSKY/commit version bump' |
496 | version: '2.035' | |
494 | version: '2.036' | |
497 | 495 | - |
498 | 496 | class: Dist::Zilla::Plugin::Git::Push |
499 | 497 | config: |
504 | 502 | Dist::Zilla::Role::Git::Repo: |
505 | 503 | repo_root: . |
506 | 504 | name: '@DROLSKY/push version bump' |
507 | version: '2.035' | |
505 | version: '2.036' | |
506 | - | |
507 | class: Dist::Zilla::Plugin::Test::Pod::LinkCheck | |
508 | name: '@DROLSKY/Test::Pod::LinkCheck' | |
509 | version: '1.002' | |
510 | - | |
511 | class: Dist::Zilla::Plugin::Test::Pod::No404s | |
512 | name: '@DROLSKY/Test::Pod::No404s' | |
513 | version: '1.002' | |
508 | 514 | - |
509 | 515 | class: Dist::Zilla::Plugin::Prereqs |
510 | 516 | config: |
0 | requires "Attribute::Handlers" => "0.79"; | |
1 | 0 | requires "Carp" => "0"; |
2 | 1 | requires "Exporter" => "0"; |
3 | 2 | requires "Module::Implementation" => "0"; |
4 | 3 | requires "Scalar::Util" => "1.10"; |
5 | 4 | requires "XSLoader" => "0"; |
6 | requires "attributes" => "0"; | |
7 | 5 | requires "perl" => "5.008001"; |
8 | 6 | requires "strict" => "0"; |
9 | 7 | requires "vars" => "0"; |
52 | 50 | requires "Test::NoTabs" => "0"; |
53 | 51 | requires "Test::Pod" => "1.41"; |
54 | 52 | requires "Test::Pod::Coverage" => "1.08"; |
53 | requires "Test::Pod::LinkCheck" => "0"; | |
54 | requires "Test::Pod::No404s" => "0"; | |
55 | 55 | requires "Test::Spelling" => "0.12"; |
56 | 56 | requires "Test::Synopsis" => "0"; |
57 | 57 | requires "Test::Taint" => "0.02"; |
0 | package Attribute::Params::Validate; | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | our $VERSION = '1.20'; | |
6 | ||
7 | use attributes; | |
8 | ||
9 | use Attribute::Handlers 0.79; | |
10 | ||
11 | # this will all be re-exported | |
12 | use Params::Validate qw(:all); | |
13 | ||
14 | require Exporter; | |
15 | ||
16 | our @ISA = qw(Exporter); | |
17 | ||
18 | my %tags = ( | |
19 | types => [ | |
20 | qw( SCALAR ARRAYREF HASHREF CODEREF GLOB GLOBREF SCALARREF HANDLE UNDEF OBJECT ) | |
21 | ], | |
22 | ); | |
23 | ||
24 | our %EXPORT_TAGS = ( | |
25 | 'all' => [ qw( validation_options ), map { @{ $tags{$_} } } keys %tags ], | |
26 | %tags, | |
27 | ); | |
28 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} }, 'validation_options' ); | |
29 | ||
30 | ||
31 | sub UNIVERSAL::Validate : ATTR(CODE, INIT) { | |
32 | _wrap_sub( 'named', @_ ); | |
33 | } | |
34 | ||
35 | sub UNIVERSAL::ValidatePos : ATTR(CODE, INIT) { | |
36 | _wrap_sub( 'positional', @_ ); | |
37 | } | |
38 | ||
39 | sub _wrap_sub { | |
40 | my ( $type, $package, $symbol, $referent, $attr, $params ) = @_; | |
41 | ||
42 | my @p = ref $params ? @{$params} : $params; | |
43 | ||
44 | my $subname = $package . '::' . *{$symbol}{NAME}; | |
45 | ||
46 | my %attributes = map { $_ => 1 } attributes::get($referent); | |
47 | my $is_method = $attributes{method}; | |
48 | ||
49 | { | |
50 | no warnings 'redefine'; | |
51 | no strict 'refs'; | |
52 | ||
53 | # An unholy mixture of closure and eval. This is done so that | |
54 | # the code to automatically create the relevant scalars from | |
55 | # the hash of params can create the scalars in the proper | |
56 | # place lexically. | |
57 | ||
58 | my $code = <<"EOF"; | |
59 | sub | |
60 | { | |
61 | package $package; | |
62 | EOF | |
63 | ||
64 | $code .= " my \$object = shift;\n" if $is_method; | |
65 | ||
66 | if ( $type eq 'named' ) { | |
67 | $params = {@p}; | |
68 | $code .= " Params::Validate::validate(\@_, \$params);\n"; | |
69 | } | |
70 | else { | |
71 | $code .= " Params::Validate::validate_pos(\@_, \@p);\n"; | |
72 | } | |
73 | ||
74 | $code .= " unshift \@_, \$object if \$object;\n" if $is_method; | |
75 | ||
76 | $code .= <<"EOF"; | |
77 | \$referent->(\@_); | |
78 | } | |
79 | EOF | |
80 | ||
81 | my $sub = eval $code; | |
82 | die $@ if $@; | |
83 | ||
84 | *{$subname} = $sub; | |
85 | } | |
86 | } | |
87 | ||
88 | 1; | |
89 | ||
90 | # ABSTRACT: Define validation through subroutine attributes | |
91 | ||
92 | __END__ | |
93 | ||
94 | =pod | |
95 | ||
96 | =head1 NAME | |
97 | ||
98 | Attribute::Params::Validate - Define validation through subroutine attributes | |
99 | ||
100 | =head1 VERSION | |
101 | ||
102 | version 1.20 | |
103 | ||
104 | =head1 SYNOPSIS | |
105 | ||
106 | use Attribute::Params::Validate qw(:all); | |
107 | ||
108 | # takes named params (hash or hashref) | |
109 | # foo is mandatory, bar is optional | |
110 | sub foo : Validate( foo => 1, bar => 0 ) | |
111 | { | |
112 | # insert code here | |
113 | } | |
114 | ||
115 | # takes positional params | |
116 | # first two are mandatory, third is optional | |
117 | sub bar : ValidatePos( 1, 1, 0 ) | |
118 | { | |
119 | # insert code here | |
120 | } | |
121 | ||
122 | # for some reason Perl insists that the entire attribute be on one line | |
123 | sub foo2 : Validate( foo => { type => ARRAYREF }, bar => { can => [ 'print', 'flush', 'frobnicate' ] }, baz => { type => SCALAR, callbacks => { 'numbers only' => sub { shift() =~ /^\d+$/ }, 'less than 90' => sub { shift() < 90 } } } ) | |
124 | { | |
125 | # insert code here | |
126 | } | |
127 | ||
128 | # note that this is marked as a method. This is very important! | |
129 | sub baz : Validate( foo => { type => ARRAYREF }, bar => { isa => 'Frobnicator' } ) method | |
130 | { | |
131 | # insert code here | |
132 | } | |
133 | ||
134 | =head1 DESCRIPTION | |
135 | ||
136 | The Attribute::Params::Validate module allows you to validate method | |
137 | or function call parameters just like Params::Validate does. However, | |
138 | this module allows you to specify your validation spec as an | |
139 | attribute, rather than by calling the C<validate> routine. | |
140 | ||
141 | Please see Params::Validate for more information on how you can | |
142 | specify what validation is performed. | |
143 | ||
144 | =head2 EXPORT | |
145 | ||
146 | This module exports everything that Params::Validate does except for | |
147 | the C<validate> and C<validate_pos> subroutines. | |
148 | ||
149 | =head2 ATTRIBUTES | |
150 | ||
151 | =over 4 | |
152 | ||
153 | =item * Validate | |
154 | ||
155 | This attribute corresponds to the C<validate> subroutine in | |
156 | Params::Validate. | |
157 | ||
158 | =item * ValidatePos | |
159 | ||
160 | This attribute corresponds to the C<validate_pos> subroutine in | |
161 | Params::Validate. | |
162 | ||
163 | =back | |
164 | ||
165 | =head2 OO | |
166 | ||
167 | If you are using this module to mark B<methods> for validation, as | |
168 | opposed to subroutines, it is crucial that you mark these methods with | |
169 | the C<:method> attribute, as well as the C<Validate> or C<ValidatePos> | |
170 | attribute. | |
171 | ||
172 | If you do not do this, then the object or class used in the method | |
173 | call will be passed to the validation routines, which is probably not | |
174 | what you want. | |
175 | ||
176 | =head2 CAVEATS | |
177 | ||
178 | You B<must> put all the arguments to the C<Validate> or C<ValidatePos> | |
179 | attribute on a single line, or Perl will complain. | |
180 | ||
181 | =head1 SEE ALSO | |
182 | ||
183 | Params::Validate | |
184 | ||
185 | =head1 AUTHORS | |
186 | ||
187 | =over 4 | |
188 | ||
189 | =item * | |
190 | ||
191 | Dave Rolsky <autarch@urth.org> | |
192 | ||
193 | =item * | |
194 | ||
195 | Ilya Martynov <ilya@martynov.org> | |
196 | ||
197 | =back | |
198 | ||
199 | =head1 COPYRIGHT AND LICENSE | |
200 | ||
201 | This software is Copyright (c) 2001 - 2015 by Dave Rolsky and Ilya Martynov. | |
202 | ||
203 | This is free software, licensed under: | |
204 | ||
205 | The Artistic License 2.0 (GPL Compatible) | |
206 | ||
207 | =cut |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.20'; | |
5 | our $VERSION = '1.21'; | |
6 | 6 | |
7 | 7 | our @ISA = 'Exporter'; |
8 | 8 |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.20'; | |
5 | our $VERSION = '1.21'; | |
6 | 6 | |
7 | 7 | use Params::Validate::Constants; |
8 | 8 | use Scalar::Util 1.10 (); |
2 | 2 | use strict; |
3 | 3 | use warnings; |
4 | 4 | |
5 | our $VERSION = '1.20'; | |
5 | our $VERSION = '1.21'; | |
6 | 6 | |
7 | 7 | use Carp; |
8 | 8 |
4 | 4 | use strict; |
5 | 5 | use warnings; |
6 | 6 | |
7 | our $VERSION = '1.20'; | |
7 | our $VERSION = '1.21'; | |
8 | 8 | |
9 | 9 | use Exporter; |
10 | 10 | use Module::Implementation; |
74 | 74 | |
75 | 75 | =head1 VERSION |
76 | 76 | |
77 | version 1.20 | |
77 | version 1.21 | |
78 | 78 | |
79 | 79 | =head1 SYNOPSIS |
80 | 80 |
0 | 0 | package # hide from PAUSE |
1 | 1 | Params::Validate; |
2 | 2 | |
3 | our $VERSION = '1.20'; | |
3 | our $VERSION = '1.21'; | |
4 | 4 | |
5 | 5 | BEGIN { $ENV{PARAMS_VALIDATE_IMPLEMENTATION} = 'PP' } |
6 | 6 | use Params::Validate; |
0 | 0 | package # hide from PAUSE |
1 | 1 | Params::Validate; |
2 | 2 | |
3 | our $VERSION = '1.20'; | |
3 | our $VERSION = '1.21'; | |
4 | 4 | |
5 | 5 | BEGIN { $ENV{PARAMS_VALIDATE_IMPLEMENTATION} = 'XS' } |
6 | 6 | use Params::Validate; |
25 | 25 | 'Test::NoTabs' => '0', |
26 | 26 | 'Test::Pod' => '1.41', |
27 | 27 | 'Test::Pod::Coverage' => '1.08', |
28 | 'Test::Pod::LinkCheck' => '0', | |
29 | 'Test::Pod::No404s' => '0', | |
28 | 30 | 'Test::Spelling' => '0.12', |
29 | 31 | 'Test::Synopsis' => '0', |
30 | 32 | 'Test::Taint' => '0.02' |
32 | 34 | }, |
33 | 35 | 'runtime' => { |
34 | 36 | 'requires' => { |
35 | 'Attribute::Handlers' => '0.79', | |
36 | 37 | 'Carp' => '0', |
37 | 38 | 'Exporter' => '0', |
38 | 39 | 'Module::Implementation' => '0', |
39 | 40 | 'Scalar::Util' => '1.10', |
40 | 41 | 'XSLoader' => '0', |
41 | 'attributes' => '0', | |
42 | 42 | 'perl' => '5.008001', |
43 | 43 | 'strict' => '0', |
44 | 44 | 'vars' => '0', |
0 | use strict; | |
1 | use warnings; | |
2 | ||
3 | use File::Spec; | |
4 | use lib File::Spec->catdir( 't', 'lib' ); | |
5 | ||
6 | use PVTests; | |
7 | use Test::More; | |
8 | ||
9 | use Attribute::Params::Validate; | |
10 | use Params::Validate qw(:all); | |
11 | ||
12 | sub foo : Validate( c => { type => SCALAR } ) { | |
13 | my %data = @_; | |
14 | return $data{c}; | |
15 | } | |
16 | ||
17 | sub bar : Validate( c => { type => SCALAR } ) method { | |
18 | my $self = shift; | |
19 | my %data = @_; | |
20 | return $data{c}; | |
21 | } | |
22 | ||
23 | sub baz : | |
24 | Validate( foo => { type => ARRAYREF, callbacks => { '5 elements' => sub { @{shift()} == 5 } } } ) | |
25 | { | |
26 | my %data = @_; | |
27 | return $data{foo}->[0]; | |
28 | } | |
29 | ||
30 | sub buz : ValidatePos( 1 ) { | |
31 | return $_[0]; | |
32 | } | |
33 | ||
34 | sub quux : ValidatePos( { type => SCALAR }, 1 ) { | |
35 | return $_[0]; | |
36 | } | |
37 | ||
38 | my $res = eval { foo( c => 1 ) }; | |
39 | is( | |
40 | $@, q{}, | |
41 | "Call foo with a scalar" | |
42 | ); | |
43 | ||
44 | is( | |
45 | $res, 1, | |
46 | 'Check return value from foo( c => 1 )' | |
47 | ); | |
48 | ||
49 | eval { foo( c => [] ) }; | |
50 | ||
51 | like( | |
52 | $@, qr/The 'c' parameter .* was an 'arrayref'/, | |
53 | 'Check exception thrown from foo( c => [] )' | |
54 | ); | |
55 | ||
56 | $res = eval { main->bar( c => 1 ) }; | |
57 | is( | |
58 | $@, q{}, | |
59 | 'Call bar with a scalar' | |
60 | ); | |
61 | ||
62 | is( | |
63 | $res, 1, | |
64 | 'Check return value from bar( c => 1 )' | |
65 | ); | |
66 | ||
67 | eval { baz( foo => [ 1, 2, 3, 4 ] ) }; | |
68 | ||
69 | like( | |
70 | $@, qr/The 'foo' parameter .* did not pass the '5 elements' callback/, | |
71 | 'Check exception thrown from baz( foo => [1,2,3,4] )' | |
72 | ); | |
73 | ||
74 | $res = eval { baz( foo => [ 5, 4, 3, 2, 1 ] ) }; | |
75 | ||
76 | is( | |
77 | $@, q{}, | |
78 | 'Call baz( foo => [5,4,3,2,1] )' | |
79 | ); | |
80 | ||
81 | is( | |
82 | $res, 5, | |
83 | 'Check return value from baz( foo => [5,4,3,2,1] )' | |
84 | ); | |
85 | ||
86 | eval { buz( [], 1 ) }; | |
87 | ||
88 | like( | |
89 | $@, qr/2 parameters were passed to .* but 1 was expected/, | |
90 | 'Check exception thrown from quux( [], 1 )' | |
91 | ); | |
92 | ||
93 | $res = eval { quux( 1, [] ) }; | |
94 | ||
95 | is( | |
96 | $@, q{}, | |
97 | 'Call quux' | |
98 | ); | |
99 | ||
100 | done_testing(); |
13 | 13 | |
14 | 14 | use Test::More; |
15 | 15 | |
16 | plan tests => 8; | |
16 | plan tests => 7; | |
17 | 17 | |
18 | 18 | my @module_files = ( |
19 | 'Attribute/Params/Validate.pm', | |
20 | 19 | 'Params/Validate.pm', |
21 | 20 | 'Params/Validate/Constants.pm', |
22 | 21 | 'Params/Validate/PP.pm', |
14 | 14 | use Test::EOL; |
15 | 15 | |
16 | 16 | my @files = ( |
17 | 'lib/Attribute/Params/Validate.pm', | |
18 | 17 | 'lib/Params/Validate.pm', |
19 | 18 | 'lib/Params/Validate/Constants.pm', |
20 | 19 | 'lib/Params/Validate/PP.pm', |
25 | 24 | 't/00-report-prereqs.t', |
26 | 25 | 't/01-validate.t', |
27 | 26 | 't/02-noop.t', |
28 | 't/03-attribute.t', | |
29 | 27 | 't/04-defaults.t', |
30 | 28 | 't/05-noop_default.t', |
31 | 29 | 't/06-options.t', |
79 | 77 | 't/release-portability.t', |
80 | 78 | 't/release-pp-01-validate.t', |
81 | 79 | 't/release-pp-02-noop.t', |
82 | 't/release-pp-03-attribute.t', | |
83 | 80 | 't/release-pp-04-defaults.t', |
84 | 81 | 't/release-pp-05-noop_default.t', |
85 | 82 | 't/release-pp-06-options.t', |
14 | 14 | use Test::NoTabs; |
15 | 15 | |
16 | 16 | my @files = ( |
17 | 'lib/Attribute/Params/Validate.pm', | |
18 | 17 | 'lib/Params/Validate.pm', |
19 | 18 | 'lib/Params/Validate/Constants.pm', |
20 | 19 | 'lib/Params/Validate/PP.pm', |
25 | 24 | 't/00-report-prereqs.t', |
26 | 25 | 't/01-validate.t', |
27 | 26 | 't/02-noop.t', |
28 | 't/03-attribute.t', | |
29 | 27 | 't/04-defaults.t', |
30 | 28 | 't/05-noop_default.t', |
31 | 29 | 't/06-options.t', |
79 | 77 | 't/release-portability.t', |
80 | 78 | 't/release-pp-01-validate.t', |
81 | 79 | 't/release-pp-02-noop.t', |
82 | 't/release-pp-03-attribute.t', | |
83 | 80 | 't/release-pp-04-defaults.t', |
84 | 81 | 't/release-pp-05-noop_default.t', |
85 | 82 | 't/release-pp-06-options.t', |
8 | 8 | use strict; |
9 | 9 | use warnings; |
10 | 10 | |
11 | use Test::LeakTrace qw( no_leaks_ok ); | |
11 | 12 | use Test::More; |
12 | ||
13 | BEGIN { | |
14 | plan skip_all => q{Test::LeakTrace doesn't install with blead (as of 5.21.8)} | |
15 | if $] >= 5.021008; | |
16 | } | |
17 | ||
18 | use Test::LeakTrace qw( no_leaks_ok ); | |
19 | 13 | |
20 | 14 | use Params::Validate qw( validate ); |
21 | 15 |
0 | ||
1 | ||
2 | use Test::More; | |
3 | ||
4 | BEGIN { | |
5 | unless ( $ENV{RELEASE_TESTING} ) { | |
6 | plan skip_all => 'these tests are for release testing'; | |
7 | } | |
8 | ||
9 | $ENV{PV_TEST_PERL} = 1; | |
10 | } | |
11 | ||
12 | use strict; | |
13 | use warnings; | |
14 | ||
15 | use File::Spec; | |
16 | use lib File::Spec->catdir( 't', 'lib' ); | |
17 | ||
18 | use PVTests; | |
19 | use Test::More; | |
20 | ||
21 | use Attribute::Params::Validate; | |
22 | use Params::Validate qw(:all); | |
23 | ||
24 | sub foo : Validate( c => { type => SCALAR } ) { | |
25 | my %data = @_; | |
26 | return $data{c}; | |
27 | } | |
28 | ||
29 | sub bar : Validate( c => { type => SCALAR } ) method { | |
30 | my $self = shift; | |
31 | my %data = @_; | |
32 | return $data{c}; | |
33 | } | |
34 | ||
35 | sub baz : | |
36 | Validate( foo => { type => ARRAYREF, callbacks => { '5 elements' => sub { @{shift()} == 5 } } } ) | |
37 | { | |
38 | my %data = @_; | |
39 | return $data{foo}->[0]; | |
40 | } | |
41 | ||
42 | sub buz : ValidatePos( 1 ) { | |
43 | return $_[0]; | |
44 | } | |
45 | ||
46 | sub quux : ValidatePos( { type => SCALAR }, 1 ) { | |
47 | return $_[0]; | |
48 | } | |
49 | ||
50 | my $res = eval { foo( c => 1 ) }; | |
51 | is( | |
52 | $@, q{}, | |
53 | "Call foo with a scalar" | |
54 | ); | |
55 | ||
56 | is( | |
57 | $res, 1, | |
58 | 'Check return value from foo( c => 1 )' | |
59 | ); | |
60 | ||
61 | eval { foo( c => [] ) }; | |
62 | ||
63 | like( | |
64 | $@, qr/The 'c' parameter .* was an 'arrayref'/, | |
65 | 'Check exception thrown from foo( c => [] )' | |
66 | ); | |
67 | ||
68 | $res = eval { main->bar( c => 1 ) }; | |
69 | is( | |
70 | $@, q{}, | |
71 | 'Call bar with a scalar' | |
72 | ); | |
73 | ||
74 | is( | |
75 | $res, 1, | |
76 | 'Check return value from bar( c => 1 )' | |
77 | ); | |
78 | ||
79 | eval { baz( foo => [ 1, 2, 3, 4 ] ) }; | |
80 | ||
81 | like( | |
82 | $@, qr/The 'foo' parameter .* did not pass the '5 elements' callback/, | |
83 | 'Check exception thrown from baz( foo => [1,2,3,4] )' | |
84 | ); | |
85 | ||
86 | $res = eval { baz( foo => [ 5, 4, 3, 2, 1 ] ) }; | |
87 | ||
88 | is( | |
89 | $@, q{}, | |
90 | 'Call baz( foo => [5,4,3,2,1] )' | |
91 | ); | |
92 | ||
93 | is( | |
94 | $res, 5, | |
95 | 'Check return value from baz( foo => [5,4,3,2,1] )' | |
96 | ); | |
97 | ||
98 | eval { buz( [], 1 ) }; | |
99 | ||
100 | like( | |
101 | $@, qr/2 parameters were passed to .* but 1 was expected/, | |
102 | 'Check exception thrown from quux( [], 1 )' | |
103 | ); | |
104 | ||
105 | $res = eval { quux( 1, [] ) }; | |
106 | ||
107 | is( | |
108 | $@, q{}, | |
109 | 'Call quux' | |
110 | ); | |
111 | ||
112 | done_testing(); | |
113 |