| 1 | package JSON::Schema::Result; | ||
| 2 | |||
| 3 | use 5.010; | ||
| 4 | use strict; | ||
| 5 | use overload bool => \&valid; | ||
| 6 | |||
| 7 | use JSON::Schema::Error; | ||
| 8 | |||
| 9 | our $AUTHORITY = 'cpan:TOBYINK'; | ||
| 10 | our $VERSION = '0.016'; | ||
| 11 | |||
| 12 | sub new | ||
| 13 | { | ||
| 14 | my ($class, $result) = @_; | ||
| 15 | return bless $result, $class; | ||
| 16 | } | ||
| 17 | |||
| 18 | sub valid | ||
| 19 | { | ||
| 20 | my ($self) = @_; | ||
| 21 | return $self->{'valid'}; | ||
| 22 | } | ||
| 23 | |||
| 24 | sub errors | ||
| 25 | { | ||
| 26 | my ($self) = @_; | ||
| 27 | return map { JSON::Schema::Error->new($_); } @{$self->{'errors'}}; | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | __END__ |