| 1 | package Validator::Lazy::Role::Check::Test; | ||
| 2 | |||
| 3 | 2 | our $VERSION = '0.03'; | |
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Validator::Lazy::Role::Check::Test | ||
| 8 | |||
| 9 | |||
| 10 | =head1 VERSION | ||
| 11 | |||
| 12 | Version 0.03 | ||
| 13 | |||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | use Validator::Lazy; | ||
| 18 | my $v = Validator::Lazy->new( ); | ||
| 19 | |||
| 20 | my $ok = $v->check( Test => 'xxxxx' ); | ||
| 21 | |||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | An internal Role for Validator::Lazy, part of Validator::Lazy package. | ||
| 26 | |||
| 27 | Provides "Test" type for Validator::Lazy config. | ||
| 28 | It is not useful package for you. It's just an example, | ||
| 29 | what we can do with lazy validator and some help for core-testing as well. | ||
| 30 | |||
| 31 | |||
| 32 | =head1 METHODS | ||
| 33 | |||
| 34 | =head2 C<check> | ||
| 35 | |||
| 36 | Called from inside if Validator::Lazy->check process | ||
| 37 | |||
| 38 | Temporary overrides internal Validator::Lazy::check method like this: | ||
| 39 | |||
| 40 | $validator->check( $value, $param ); | ||
| 41 | |||
| 42 | |||
| 43 | =head1 SUPPORT AND DOCUMENTATION | ||
| 44 | |||
| 45 | After installing, you can find documentation for this module with the perldoc command. | ||
| 46 | |||
| 47 | perldoc Validator::Lazy | ||
| 48 | |||
| 49 | You can also look for information at: | ||
| 50 | |||
| 51 | RT, CPAN's request tracker (report bugs here) | ||
| 52 | http://rt.cpan.org/NoAuth/Bugs.html?Dist=Validator-Lazy | ||
| 53 | |||
| 54 | AnnoCPAN, Annotated CPAN documentation | ||
| 55 | http://annocpan.org/dist/Validator-Lazy | ||
| 56 | |||
| 57 | CPAN Ratings | ||
| 58 | http://cpanratings.perl.org/d/Validator-Lazy | ||
| 59 | |||
| 60 | Search CPAN | ||
| 61 | http://search.cpan.org/dist/Validator-Lazy/ | ||
| 62 | |||
| 63 | |||
| 64 | =head1 AUTHOR | ||
| 65 | |||
| 66 | ANTONC <antonc@cpan.org> | ||
| 67 | |||
| 68 | =head1 LICENSE | ||
| 69 | |||
| 70 | This program is free software; you can redistribute it and/or modify it | ||
| 71 | under the terms of the the Artistic License (2.0). You may obtain a | ||
| 72 | copy of the full license at: | ||
| 73 | |||
| 74 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | 2 | ▶ | use v5.14.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 79 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 80 | 2 | ▶ | use Modern::Perl; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 81 | 2 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 82 | |||
| 83 | 2 | ▶ | sub before_check { |
|
Subroutine
before_check: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 84 | 2 | my ( $self, $value ) = @_; | |
| 85 | |||
| 86 | 2 | $self->add_error( { x_err => 'err data' } ); | |
| 87 | 2 | $self->add_warning( { x_warn => 'warn data' } ); | |
| 88 | |||
| 89 | 2 | return $value + 5; | |
| 90 | }; | ||
| 91 | |||
| 92 | 2 | ▶ | sub check { |
|
Subroutine
check: called CC=1 SCAR=0.0
Pod
documented
| |||
| 93 | 2 | my ( $self, $value ) = @_; | |
| 94 | |||
| 95 | 2 | $self->add_error( 'CHECK_TEST_ERR_CODE' => { x_chk_err => 'err check data' } ); | |
| 96 | 2 | $self->add_warning( 'CHECK_TEST_WRN_CODE' => { x_chk_warn => 'warn check data' } ); | |
| 97 | |||
| 98 | 2 | return $value + 50; | |
| 99 | }; | ||
| 100 | |||
| 101 | 2 | ▶ | sub after_check { |
|
Subroutine
after_check: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 102 | 2 | my ( $self, $value ) = @_; | |
| 103 | |||
| 104 | 2 | $self->add_error( 'AFTER_TEST_ERR_CODE' ); | |
| 105 | 2 | $self->add_warning( 'AFTER_TEST_WRN_CODE' ); | |
| 106 | |||
| 107 | 2 | return $value + 500; | |
| 108 | }; | ||
| 109 | |||
| 110 | 2 | 1; | |