| 1 | #!/usr/bin/env perl | ||
| 2 | #* | ||
| 3 | #* Info: Ref types definitions module | ||
| 4 | #* Author: Pawel Guspiel (neo77) <neo@cpan.org> | ||
| 5 | #* | ||
| 6 | #* This module keeps validation functions. You can of course add your modules which uses this and will add additional checks | ||
| 7 | #* Build in types for Params::Dry | ||
| 8 | #* | ||
| 9 | package Params::Dry::Types::Ref; | ||
| 10 | { | ||
| 11 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 4 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | # --- version --- | ||
| 16 | 4 | our $VERSION = 1.20_03; | |
| 17 | |||
| 18 | #=------------------------------------------------------------------------ { use, constants } | ||
| 19 | |||
| 20 | 4 | ▶ | use Params::Dry::Types qw(:const); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | #=------------------------------------------------------------------------ { module public functions } | ||
| 23 | |||
| 24 | #=--------- | ||
| 25 | # Scalar | ||
| 26 | #=--------- | ||
| 27 | #* scalar type check | ||
| 28 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 29 | 2 | ▶ | sub Scalar { |
|
Subroutine
Scalar: called CC=1 SCAR=0.0
Pod
documented
| |||
| 30 | 2 | Params::Dry::Types::Ref( $_[0], 'SCALAR' ); | |
| 31 | } #+ end of: sub Scalar | ||
| 32 | |||
| 33 | #=-------- | ||
| 34 | # Array | ||
| 35 | #=-------- | ||
| 36 | #* array type check | ||
| 37 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 38 | 7 | ▶ | sub Array { |
|
Subroutine
Array: called CC=1 SCAR=0.0
Pod
documented
| |||
| 39 | 7 | Params::Dry::Types::Ref( $_[0], 'ARRAY' ); | |
| 40 | } #+ end of: sub Array | ||
| 41 | |||
| 42 | #=------- | ||
| 43 | # Hash | ||
| 44 | #=------- | ||
| 45 | #* hash type check | ||
| 46 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 47 | 2 | ▶ | sub Hash { |
|
Subroutine
Hash: called CC=1 SCAR=0.0
Pod
documented
| |||
| 48 | 2 | Params::Dry::Types::Ref( $_[0], 'HASH' ); | |
| 49 | } #+ end of: sub Hash | ||
| 50 | |||
| 51 | #=------- | ||
| 52 | # Code | ||
| 53 | #=------- | ||
| 54 | #* code type check | ||
| 55 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 56 | 2 | ▶ | sub Code { |
|
Subroutine
Code: called CC=1 SCAR=0.0
Pod
documented
| |||
| 57 | 2 | Params::Dry::Types::Ref( $_[0], 'CODE' ); | |
| 58 | } #+ end of: sub Code | ||
| 59 | |||
| 60 | #=------- | ||
| 61 | # Glob | ||
| 62 | #=------- | ||
| 63 | #* glob type check | ||
| 64 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 65 | 1 | ▶ | sub Glob { |
|
Subroutine
Glob: called CC=1 SCAR=0.0
Pod
documented
| |||
| 66 | 1 | Params::Dry::Types::Ref( $_[0], 'GLOB' ); | |
| 67 | } #+ end of: sub Glob | ||
| 68 | |||
| 69 | #=------- | ||
| 70 | # Ref | ||
| 71 | #=------- | ||
| 72 | #* Ref to Ref type check | ||
| 73 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 74 | 1 | ▶ | sub Ref { |
|
Subroutine
Ref: called CC=1 SCAR=0.0
Pod
documented
| |||
| 75 | 1 | Params::Dry::Types::Ref( $_[0], 'REF' ); | |
| 76 | } #+ end of: sub Ref | ||
| 77 | |||
| 78 | #=--------- | ||
| 79 | # LValue | ||
| 80 | #=--------- | ||
| 81 | #* lvalue type check | ||
| 82 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 83 | 1 | ▶ | sub LValue { |
|
Subroutine
LValue: called CC=1 SCAR=0.0
Pod
documented
| |||
| 84 | 1 | Params::Dry::Types::Ref( $_[0], 'LVALUE' ); | |
| 85 | } #+ end of: sub LValue | ||
| 86 | |||
| 87 | #=--------- | ||
| 88 | # Format | ||
| 89 | #=--------- | ||
| 90 | #* format type check | ||
| 91 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 92 | 1 | ▶ | sub Format { |
|
Subroutine
Format: called CC=1 SCAR=0.0
Pod
documented
| |||
| 93 | 1 | Params::Dry::Types::Ref( $_[0], 'FORMAT' ); | |
| 94 | } #+ end of: sub Format | ||
| 95 | |||
| 96 | #=---------- | ||
| 97 | # VString | ||
| 98 | #=---------- | ||
| 99 | #* glob type check | ||
| 100 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 101 | 1 | ▶ | sub VString { |
|
Subroutine
VString: called CC=1 SCAR=0.0
Pod
documented
| |||
| 102 | 1 | Params::Dry::Types::Ref( $_[0], 'VSTRING' ); | |
| 103 | } #+ end of: sub VString | ||
| 104 | |||
| 105 | #=--------- | ||
| 106 | # Regexp | ||
| 107 | #=--------- | ||
| 108 | #* glob type check | ||
| 109 | #* RETURN: PASS if test pass otherwise FAIL | ||
| 110 | 2 | ▶ | sub Regexp { |
|
Subroutine
Regexp: called CC=1 SCAR=0.0
Pod
documented
| |||
| 111 | 2 | Params::Dry::Types::Ref( $_[0], 'Regexp' ); | |
| 112 | } #+ end of: sub Regexp | ||
| 113 | |||
| 114 | 4 | }; | |
| 115 | 4 | 0115 && 0x4d; | |
| 116 | |||
| 117 | #+ End of Params::Dry::Types::Ref | ||
| 118 | __END__ | ||