| 1 | package Data::TreeValidator::Util; | ||
| 2 | { | ||
| 3 | 6 | $Data::TreeValidator::Util::VERSION = '0.04'; | |
| 4 | } | ||
| 5 | # ABSTRACT: Helpful utilities for working with tree validators | ||
| 6 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 6 | ▶ | use Sub::Exporter -setup => { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | exports => [qw( fail_constraint )] | ||
| 11 | 6 | }; | |
| 12 | |||
| 13 | { | ||
| 14 | package Data::TreeValidator::ConstraintError; | ||
| 15 | { | ||
| 16 | 6 | $Data::TreeValidator::ConstraintError::VERSION = '0.04'; | |
| 17 | } | ||
| 18 | 6 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 6 | with 'Throwable'; | |
| 20 | |||
| 21 | # XXX I think Throwable should provide this as a role - submit patch | ||
| 22 | use overload | ||
| 23 | 6 | ▶ | q{""} => 'as_string', |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 6 | fallback => 1; | |
| 25 | 6 | has 'message' => ( is => 'ro' ); | |
| 26 | 39 | ▶ | sub as_string { shift->message } |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 27 | } | ||
| 28 | |||
| 29 | 6 | ▶ | sub fail_constraint { |
|
Subroutine
fail_constraint: called CC=1 SCAR=0.0
Pod
documented
| |||
| 30 | 22 | Data::TreeValidator::ConstraintError->new( | |
| 31 | message => shift )->throw; | ||
| 32 | } | ||
| 33 | |||
| 34 | 6 | 1; | |
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | __END__ | ||